src/egonomy/templates/egonomy_create_fragment.html
changeset 69 412ab5e76c65
parent 68 dc6f8802c08a
child 70 6b49096afdc2
equal deleted inserted replaced
68:dc6f8802c08a 69:412ab5e76c65
    21 {{block.super}}
    21 {{block.super}}
    22         <script type="text/javascript">
    22         <script type="text/javascript">
    23             window.onload = function() {
    23             window.onload = function() {
    24             	if($("#add_rmn_tags")){
    24             	if($("#add_rmn_tags")){
    25 	                $("#add_rmn_tags").click(function() {
    25 	                $("#add_rmn_tags").click(function() {
    26 	                	addTags($("#rmn_tags").html().split(','))
    26 	                	addTags($("#rmn_tags").text().split(','))
    27 	                });
    27 	                });
    28             	}
    28             	}
    29                 if($("#add_pertimm_title")){
    29                 if($("#add_pertimm_title")){
    30                     $("#add_pertimm_title").click(function() {
    30                     $("#add_pertimm_title").click(function() {
    31                     	addTags($("#pertimm_title_tags").html().split(','))
    31                     	addTags($("#pertimm_title_tags").text().split(','))
    32                     });
    32                     });
    33                 }
    33                 }
    34                 if($("#add_pertimm_description")){
    34                 if($("#add_pertimm_description")){
    35                     $("#add_pertimm_description").click(function() {
    35                     $("#add_pertimm_description").click(function() {
    36                     	addTags($("#pertimm_description_tags").html().split(','))
    36                     	addTags($("#pertimm_description_tags").text().split(','))
    37                     });
    37                     });
    38                 }
    38                 }
    39                 if($("#add_pertimm_thesaurus")){
    39                 if($("#add_pertimm_thesaurus")){
    40                     $("#add_pertimm_thesaurus").click(function() {
    40                     $("#add_pertimm_thesaurus").click(function() {
    41                     	addTags($("#pertimm_thesaurus_tags").html().split(','))
    41                     	addTags($("#pertimm_thesaurus_tags").text().split(','))
    42                     });
    42                     });
    43                 }
    43                 }
       
    44                 $(".addable_tag").click(function() {
       
    45                     addTags([$(this).text()])
       
    46                 });
    44            	};
    47            	};
    45            	function addTags(tags){
    48            	function addTags(tags){
    46                 nt = tags.length;
    49                 nt = tags.length;
    47                 for(var i=0; i<nt; i++){
    50                 for(var i=0; i<nt; i++){
    48                     $('#user_keywords').tagit('createTag', tags[i]);
    51                     $('#user_keywords').tagit('createTag', tags[i]);
   104                                     <td><input id="user_keywords" name="user_keywords" class="user-keywords"></ul><!--textarea class="user-keywords" name="user_keywords" id="user_keywords"></textarea--></td>
   107                                     <td><input id="user_keywords" name="user_keywords" class="user-keywords"></ul><!--textarea class="user-keywords" name="user_keywords" id="user_keywords"></textarea--></td>
   105                                 </tr>
   108                                 </tr>
   106                                 {% if img.metadata.mots_cles %}
   109                                 {% if img.metadata.mots_cles %}
   107                                 <tr>
   110                                 <tr>
   108                                     <th>{% trans 'RMN keywords' %}&nbsp;:</th>
   111                                     <th>{% trans 'RMN keywords' %}&nbsp;:</th>
   109                                     <td><span id="rmn_tags">{{ img.metadata.mots_cles }}</span><br/><span id="add_rmn_tags" class="right add_tag_btn">+ {% trans 'Add RMN keywords to yours' %}</span></td>
   112                                     <td><span id="rmn_tags">{% for t in img.metadata.mots_cles_list %}<span class="clickable addable_tag">{{ t }}</span>{% if not forloop.last %}, {% endif %}{% endfor %}</span>
       
   113                                         <br/><span id="add_rmn_tags" class="right clickable">+ {% trans 'Add all RMN keywords to yours' %}</span></td>
   110                                 </tr>
   114                                 </tr>
   111                                 {% endif %}
   115                                 {% endif %}
   112                                 {% if img.metadata.titre_pertimm %}
   116                                 {% if img.metadata.titre_pertimm %}
   113 	                            <tr>
   117 	                            <tr>
   114 	                                <th>{% trans "Pertimm title" %}&nbsp;:</th>
   118 	                                <th>{% trans "Pertimm title" %}&nbsp;:</th>
   115 	                                <td><span id="pertimm_title_tags">{{ img.metadata.titre_pertimm|default:"" }}</span><br/><span id="add_pertimm_title" class="right add_tag_btn">+ {% trans 'Add Pertimm title keywords to yours' %}</span></td>
   119 	                                <td><span id="pertimm_title_tags">{% for t in img.metadata.titre_pertimm_list %}<span class="clickable addable_tag">{{ t }}</span>{% if not forloop.last %}, {% endif %}{% endfor %}</span>
       
   120 	                                    <br/><span id="add_pertimm_title" class="right clickable">+ {% trans 'Add all Pertimm title keywords to yours' %}</span></td>
   116 	                            </tr>
   121 	                            </tr>
   117                                 {% endif %}
   122                                 {% endif %}
   118                                 {% if img.metadata.description_pertimm %}
   123                                 {% if img.metadata.description_pertimm %}
   119 	                            <tr>
   124 	                            <tr>
   120 	                                <th>{% trans "Pertimm description" %}&nbsp;:</th>
   125 	                                <th>{% trans "Pertimm description" %}&nbsp;:</th>
   121 	                                <td><span id="pertimm_description_tags">{{ img.metadata.description_pertimm|default:"" }}</span><br/><span id="add_pertimm_description" class="right add_tag_btn">+ {% trans 'Add Pertimm description keywords to yours' %}</span></td>
   126 	                                <td><span id="pertimm_description_tags">{% for t in img.metadata.description_pertimm_list %}<span class="clickable addable_tag">{{ t }}</span>{% if not forloop.last %}, {% endif %}{% endfor %}</span>
       
   127 	                                    <br/><span id="add_pertimm_description" class="right clickable">+ {% trans 'Add all Pertimm description keywords to yours' %}</span></td>
   122 	                            </tr>
   128 	                            </tr>
   123                                 {% endif %}
   129                                 {% endif %}
   124                                 {% if img.metadata.thesaurus_pertimm %}
   130                                 {% if img.metadata.thesaurus_pertimm %}
   125 	                            <tr>
   131 	                            <tr>
   126 	                                <th>{% trans "Pertimm thesaurus" %}&nbsp;:</th>
   132 	                                <th>{% trans "Pertimm thesaurus" %}&nbsp;:</th>
   127 	                                <td><span id="pertimm_thesaurus_tags">{{ img.metadata.thesaurus_pertimm_str|default:"" }}</span><br/><span id="add_pertimm_thesaurus" class="right add_tag_btn">+ {% trans 'Add Pertimm thesaurus keywords to yours' %}</span></td>
   133 	                                <td><span id="pertimm_thesaurus_tags">{% for t in img.metadata.thesaurus_pertimm_list %}<span class="clickable addable_tag">{{ t }}</span>{% if not forloop.last %}, {% endif %}{% endfor %}</span>
       
   134 	                                    <br/><span id="add_pertimm_thesaurus" class="right clickable">+ {% trans 'Add all Pertimm thesaurus keywords to yours' %}</span></td>
   128 	                            </tr>
   135 	                            </tr>
   129                                 {% endif %}
   136                                 {% endif %}
   130                             </table>
   137                             </table>
   131                             <div class="fullwidth">
   138                             <div class="fullwidth">
   132                                 <input class="user-submit" type="submit" value="{% trans 'Save the fragment' %}" />
   139                                 <input class="user-submit" type="submit" value="{% trans 'Save the fragment' %}" />