summaryrefslogtreecommitdiffstats
path: root/askbot/skins/default/templates/embed/ask_by_widget.html
blob: 8b5fc5e222d04a949d36d8d5e90b99b61232a273 (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
{% extends "widget_base.html" %}
{% import "macros.html" as macros %}
{% block forestyle %}
  <style type="text/css" media="screen">
    #editor {
      display: block;
      min-height: 200px;
      width: 100%;
      margin: 0;
      border: #CCE6EC 2px solid;
    }

    #id_title{
      width: 100%;
      font-size: 130%;
      border: #CCE6EC 3px solid;
    }

    #submit{
      float: right; 
      font-size: 130%;
    }

    .title{
      font-family: 'Open Sans Condensed', Arial, sans-serif; 
      font-size: 25px;
      margin-bottom: 10px;
    }

    #question-list {
      height: auto;
    }

    #question-list h2{
      text-decoration: none;
      margin: 0px;
      font-size: 13px;
      color: #005580;
      padding: 3px 0 3px 5px;
      margin-left: 15px;
      padding-bottom: 0;
      border-top: #F0F0EC 1px solid;
      border-left: #F0F0EC 1px solid;
      min-height: 30px;
      line-height: 30px;
      font-weight: normal
    }

    #question-list a:hover{
        color: #005580;
        text-decoration: underline;
    }

    #question-list a:visited{
      color: #005580;
      text-decoration: none;
    }

    #question-list span{
      width: 28px;
      height: 26px;
      line-height: 26px;
      text-align: center;
      margin-right: 10px;
      float: left;
      display: block;
      color: white;
      background: #B8D0D5;
      border-radius: 3px;
      -ms-border-radius: 3px;
      -moz-border-radius: 3px;
      -webkit-border-radius: 3px;
      -khtml-border-radius: 3px;
    }
    {{widget.inner_style}}
  </style>
{%endblock%}

{%block body%}
<div class="title">{{widget.title}}</div>
<form action="." method="POST" accept-charset="utf-8">
  {% csrf_token %}
  <label>{%trans%}Please enter a descriptive title for your question{%endtrans%}</label>
  <input autocomplete="off" id="id_title" type="text" name="title" size="70" class='questionTitleInput'>
  {% if related_questions %}
  <div id='question-list'>
  </div>
  {%endif%}
  {{form.text}}
  {% if form.ask_anonymously %}
    <p>{{form.ask_anonymously.label_tag()}}: {{form.ask_anonymously}}</p>
  {%endif%}
  <input type="submit" value="Ask your question" id="submit" />
</form>
{{form.errors}}
{%endblock%}
{% block endjs %}
  <script type='text/javascript' src='{{"/js/live_search_new_thread.js"|media}}'></script>
  <script type="text/javascript" charset="utf-8">
    var minSearchWordLength = {{settings.MIN_SEARCH_WORD_LENGTH}};
    askbot['urls']['api_get_questions'] = '{% url api_get_questions %}';
    liveSearchNewThreadInit();
/*
    var createRelatedDOM = function(data){
      element = $('<div></div>');
      element.attr({class:"question"});
      link = $("<a></a>");
      //link.attr({href:})
      link.text(data.title);
      element.append(link);
      $('.related-questions').append(element);
    };

    $(document).ready(function(){
      $('.related-questions').hide();
      $("#id_title").change(function(){
        data = {query: this.value, _: new Date().getTime()};
        console.log(data);
        $.getJSON("{% url api_get_questions %}", data, function(data){

          console.log('entro');
          if (data.length != 0){
            $('.related-questions').show();
          } else{
            $('.related-questions').hide();
          }

          $.each(data, function(key, value){
            createRelatedDOM(value);
          });
        }); 
      });
        
    });
    */
  </script>
{% endblock %}