summaryrefslogtreecommitdiff
path: root/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/edit_thread.html
blob: ebc2313af35322d8f560f03b6331caca7ea1409e (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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
{% extends "ndf/base.html" %}
{% load i18n %}
{% load ndf_tags %}
{% block title %}Creating Thread to Forum:  {{forum.name}} {% endblock %}

{% 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 %}


{% block body_content %} 
    
  <h2>{% trans "Edit Thread " %}</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="edit_thread" method="POST">
  {% csrf_token %}

    <!-- 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="Change the name of thread" 
        name="thread_name" id="thread_name" value="{{thread.name}}">
        <input id="exst_thread_name" type="hidden" value="{{thread.name}}">
         
      </div>
    </div>
    <br/><br/>
 <input type="hidden" id="forum_threads" value="{{request.session.nodes}}"/>  
    <!-- 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;">
{% include "ndf/add_editor.html" with var_name="content_org" var_value=thread.content_org|default_if_none:"" node_id=thread.pk %}

        <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="Edit thread" onclick="saveforum()">
      </div>

    </div>
 
  </form>

{% endblock %}


{% block script %}



  // <script type="text/javascript">
  $("#node_search_form").parent().hide();

  var flag = false;

{% block document_ready %}

  
    $('#orgitdown').orgitdown(mySettings);
     
    $("#thread_name").change(function(){
    var nodes = JSON.parse($("#forum_threads").val());
      var name = $("#thread_name").val().toLowerCase();
      nodes.forEach( function(s, i){ nodes[i] = s.toLowerCase()})
      var exst_name=$("#exst_thread_name").val().toLowerCase();
      if (exst_name == name)
      {
        flag = true;
        $("#message").css("display", "none");
      }
      else
      {
       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();
    var exst_name=$("#exst_thread_name").val().toLowerCase();  
    if (name=="" )
    {
      alert("Please enter thread name");
    }
    else if(!flag)
    {
      if (exst_name == name)
      {
        flag = true;
        $("#message").css("display", "none");
        $("#forum").trigger('click');
      }
      else
       {
       alert("Thread with same name already exist !")
       } 
    }
    else
    {
      $("#forum").trigger('click');
    }
  }

{% endblock %}
  // ==================================

  // orgitdown

  // </script>


{% endblock %}