summaryrefslogtreecommitdiff
path: root/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/create_thread.html
blob: 92fffc2ac9ba61defe69f0c73e3a19ebc91fdbe8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
{% extends "ndf/base.html" %}
{% load i18n %}
{% load ndf_tags %}
{% load cache %}

{% block title %}Creating Thread to Forum:  {{forum.name}} {% endblock %}

{% cache 3600 create_thread request.LANGUAGE_CODE %}

{% block head %}

  <!-- orgitdown! -->
  <script type="text/javascript" src="/static/ndf/orgitdown/jquery.orgitdown-foundation.js"></script>
  <!-- orgitdown! toolbar settings -->
  <script type="text/javascript" src="/static/ndf/orgitdown/skins/gstudio/set.js"></script>
  <!-- orgitdown! skin -->
  <link rel="stylesheet" type="text/css" href="/static/ndf/orgitdown/skins/gstudio/style.css" />

  <style type="text/css">
    #save_form{ margin-top: 2em; }
    
    .pricing-table li.bullet-item {  text-align: left; }

    .forum-summary{
      background-color: #efefef;
      box-shadow: 0px 2px 2px 2px lightgray;
      margin: 2em 1em !important;
      padding: 1em;
      border : medium gray;
      border-radius: 4px;
    }

    .forum-summary .user {  font-size: 1.5em;}
    .forum-summary .user i { border-radius: 50px; }
  </style>
  
{% endblock %}


{% block meta_content %}
  <h2 style="border-bottom: medium dotted #008759; margin-top: -1.3rem; padding-bottom: 1rem;">{% trans "Thread" %}</h2>
  <br/>  
{% endblock %}


{% block concern_information %}
  <div id="thread-listing"></div>
{% endblock %}


{% block help_content %}
  <p>{% trans "Threads are new ideas on the topic" %}</p>
{% endblock %}

{% endcache %}


{% block body_content %} 
    
  <h2>{% trans "Add a new Thread to forum" %}</h2>
  
  <div class="row forum-summary">
    <div class="small-2 columns">
      <a class="user"></a>
      <br/><br/>
      <i>{{ forum_created_by }}</i> <br/>
      <small>{{forum.created_at|date:"D d M Y" }}</small>
      <!-- <small>{#{#forum.created_by}}</small> -->
    </div>
    <div class="small-10 columns">
      <font size ="5">Forum: <a href="/{{groupid}}/forum/{{forum}}">
        {{forum.name}}</a></font>
      <!-- <hr style="margin:0.5rem 0;" /> -->
      <br/><br/>      
      <blockquote>
        <!-- #{#{forum.content|default_if_none:"No description !!"}} -->
        {% with forum.content|safe as forum_content %}
          {{forum_content}}
        {% endwith %}
      </blockquote>
    </div>
  </div>
  <hr/>
  <!-- <hr/> -->

  <form id="create_thread" method="POST">
  {% csrf_token %}
  {% cache 3600 create_thread_form request.LANGUAGE_CODE %}

    <!-- forum name   -->
    <div class="row">
      <div class="large-2 medium-4 columns "><h5><b>{% trans "Thread:" %} </b></h5></div>
      <div class="large-pull-4 large-6 medium-8 columns">
        <input type="text" placeholder="Enter the name of thread here" 
        name="thread_name" id="thread_name">
        <input type="hidden" id="forum_threads" value="{{forum_threads}}"/>          
      </div>
    </div>
    <br/><br/>

    <!-- Description org editor -->
    <h5><b>{% trans "Thread Content: " %}</b></h5>
    <div class="row">
      <div class="large-8 large-pull-4 large-offset-4 columns" 
           style="padding:0 1.65em 0 1.4em;">

        <textarea id="orgitdown" name="content_org" 
        placeholder="Some description about the thread ..."></textarea>
        <div id="message" style="display:none; color:red"></div>
        <!-- <input type="button" id="save_edit_cont" class="button" value="Save"> -->
      </div>
      <br/>

      <!-- Final Create forum button -->
      <div class="large-8 columns">
        <input type="submit" id="forum" value="Create Forum" style="display:none">
        <!-- <input id="forum" type="hidden" value="{{forum}}"> -->
        <input type="button" id="save_form" class="button expand" value="Create thread" onclick="saveforum()">
      </div>

    </div>
    
    {% endcache %}
  </form>

{% endblock %}

{% block document_ready %}
  // orgitdown
  $('#orgitdown').orgitdown(mySettings);
{% endblock %}

{% block script %}
  $("#node_search_form").parent().hide();

  var flag = false;
  var nodes = JSON.parse($("#forum_threads").val());

  html = '<ul class="pricing-table"> <li class="title">{% trans "Existing threads of forum" %} </li>'
  nodes.forEach( function(s, i){ html += '<li class="bullet-item">' + s + '</li>' });

  $("#thread-listing").html(html + "</ul>");

  $("#thread_name").change(function(){
    var name = $("#thread_name").val().toLowerCase();
    nodes.forEach( function(s, i){ nodes[i] = s.toLowerCase()})

    if (nodes.indexOf(name) > -1)
    {
      flag = false;
      $("#message").css("display", "block");
      $("#message").html("Name '"+ name +"' already exist .. Please choose another name");
      $("#thread_name").val("");
    }
    else
    {
      flag = true;
      $("#message").css("display", "none");
    }
  });

  function saveforum(){
    var name=$("#thread_name").val();
    if (name=="" )
    {
      alert("Please enter forum name");
    }
    else if(!flag)
    {
      alert("Thread with same name already exist !")
    }
    else
    {
      $("#forum").trigger('click');
    }
  }
{% endblock %}