simplewiki_base.html 4.86 KB
Newer Older
1 2
##This file is based on the template from the SimpleWiki source which carries the GPL license

3 4 5
<%inherit file="../main.html"/>
<%namespace name='static' file='../static_content.html'/>

6 7 8 9
<%block name="headextra">
  <%static:css group='course'/>
</%block>

10 11
<%!
  from django.core.urlresolvers import reverse
12
  from simplewiki.views import wiki_reverse
13
%>
14

15
<%block name="js_extra">
16
<script type="text/javascript" src="${static.url('js/simplewiki-AutoSuggest_c_2.0.js')}"></script>
17

18 19 20 21
## TODO (cpennington): Remove this when we have a good way for modules to specify js to load on the page
## and in the wiki
<script type="text/javascript" src="${static.url('js/schematic.js')}"></script>

22 23 24 25 26 27 28 29 30
  <script type="text/javascript">
    function set_related_article_id(s) {
      document.getElementById('wiki_related_input_id').value = s.id;
      document.getElementById('wiki_related_input_submit').disabled=false;
    }
    %if wiki_article is not UNDEFINED:
    var x = window.onload;
    window.onload = function(){
        var options = {
31
        script: "${ wiki_reverse('search_related', wiki_article, course)}/?self=${wiki_article.pk}&",
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
        json: true,
        varname: "query",
        maxresults: 35,
        callback: set_related_article_id,
        noresults: "Nothing found!"
      };
      var as = new AutoSuggest('wiki_related_input', options);
      if (typeof x == 'function')
        x();
    }
    %endif
  </script>
  <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {inlineMath: [ ['$','$'], ["\\(","\\)"]],
                displayMath: [ ['$$','$$'], ["\\[","\\]"]]}
    });
49
  </script> 
50 51 52 53 54 55 56 57 58 59 60
  <script>
  $(function(){
  $.ajaxSetup ({
      // Disable caching of AJAX responses
      cache: false
  });

  $(".div_wiki_circuit").each(function(d,e) {
     id = $(this).attr("id");
     name = id.substring(17);
     //alert(name);
Piotr Mitros committed
61
     $("#"+id).load("/edit_circuit/"+name, function(){update_schematics();});
62
     f=this;
63
  });
64 65 66 67 68 69 70 71

  $("#wiki_create_form").hide();

  $("#create-article").click(function() {
      $("#wiki_create_form").slideToggle();
      $(this).parent().toggleClass("active");
  });

Piotr Mitros committed
72
  });
73
  </script>
74

75
  <%block name="wiki_head"/>
76

77
</%block>
78

79
<%block name="bodyextra">
80

81
%if course:
82
<%include file="/courseware/course_navigation.html" args="active_page='wiki'" />
83
%endif
84

85
<section class="container">
86
  <div class="wiki-wrapper">
87
    <%block name="wiki_panel">
88
    <div aria-label="Wiki Navigation" id="wiki_panel">
89
      <h2>Course Wiki</h2>
90
      <ul class="action">
91
        <li>
92
          <h3>
93
            <a href="${wiki_reverse("wiki_list_articles", course=course, namespace=namespace)}">All Articles</a>
94
          </h3>
95
        </li>
96

97 98 99 100 101 102
        <li class="create-article">
          <h3>
            <a href="#" id="create-article"/>Create Article</a>
          </h3>

          <div id="wiki_create_form">
103
            <%
104
            baseURL = wiki_reverse("wiki_create", course=course, kwargs={"article_path" : namespace + "/" })
105 106
            %>
            <form method="GET" onsubmit="this.action='${baseURL}' + this.wiki_article_name.value.replace(/([^a-zA-Z0-9\-])/g, '');">
107 108
              <div>
                <label for="id_wiki_article_name">Title of article</label>
109
                <input type="text" name="wiki_article_name" id="id_wiki_article_name" />
110 111 112
              </div>
              <ul>
                <li>
113
                  <input type="submit" class="button" value="Create" />
114 115 116 117 118
                </li>
              </ul>
            </form>
          </div>
        </li>
119 120

        <li class="search">
121
          <form method="GET" action='${wiki_reverse("wiki_search_articles", course=course, namespace=namespace)}'>
122
            <label class="wiki_box_title">Search</label>
123 124
            <input type="text" placeholder="Search" name="value" id="wiki_search_input" value="${wiki_search_query if wiki_search_query is not UNDEFINED else '' |h}"/>
            <input type="submit" id="wiki_search_input_submit" value="Go!" />
125
          </form>
126
        </li>
127 128 129 130 131 132
      </ul>

    </div>
    </%block>

    <section class="wiki-body">
133 134 135 136
      %if wiki_article is not UNDEFINED:
      <header>
        %if wiki_article.locked:
        <p><strong>This article has been locked</strong></p>
137
        %endif
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
        <p>Last modified: ${wiki_article.modified_on.strftime("%b %d, %Y, %I:%M %p")}</p>
        %endif

        %if wiki_article is not UNDEFINED:
        <ul>

          <li>
            <a href="${ wiki_reverse('wiki_view', wiki_article, course)}" class="view">View</a>
          </li>

          <li>
            <a href="${ wiki_reverse('wiki_edit', wiki_article, course)}" class="edit">Edit</a>
          </li>

          <li>
            <a href="${ wiki_reverse('wiki_history', wiki_article, course)}" class="history">History</a>
          </li>
        </ul>
      </header>
      %endif
158

159
      <%block name="wiki_page_title"/>
160 161 162
      <%block name="wiki_body"/>
    </section>
  </div>
163
</section>
164
</%block>