Revision 634
- Date:
- 2016/12/19 18:37:20
- Files:
-
- /utf8/plugins/tag/comps/contenido/tag/ajax/find.html (Diff) (Checkout)
- /utf8/plugins/tag/comps/contenido/tag/components/block_tag_objects.msn (Diff) (Checkout)
- /utf8/plugins/tag/comps/contenido/tag/components/block_tag_tabs.msn (Diff) (Checkout)
- /utf8/plugins/tag/comps/contenido/tag/components/form_tag_edit.msn (Diff) (Checkout)
- /utf8/plugins/tag/comps/contenido/tag/i/css/styles.css (Diff) (Checkout)
Legend:
- Added
- Removed
- Modified
-
utf8/plugins/tag/comps/contenido/tag/ajax/find.html
1 <% $json %> 2 <%once> 3 4 use JSON::XS; 5 6 </%once> 7 <%args> 8 9 $id => undef 10 $name => undef 11 12 </%args> 13 <%init> 14 15 warn Dumper \%ARGS if $DEBUG; 16 17 my %result; 18 if ( $id && $id =~ /^\d+$/ || $name && length( Encode::decode('utf-8', $name) ) > 1 ) { 19 my @tags = $keeper->get_documents( 20 class => 'tag::Tag', 21 status => 1, 22 $id ? ( id => [$id] ) : (name => '%'.$name.'%'), 23 ilike => 1, 24 order_by => 'name', 25 ); 26 $result{success} = 1; 27 if ( @tags ) { 28 $result{html} = Encode::decode('utf-8', $m->scomp('/contenido/tag/components/block_tag_list.msn', tags => \@tags) ); 29 } else { 30 $result{html} = ''; 31 } 32 } else { 33 $result{error} = Encode::decode('utf-8', 'Недостаточные параметры для поиска тега'); 34 } 35 my $json = encode_json \%result; 36 37 </%init> -
utf8/plugins/tag/comps/contenido/tag/components/block_tag_objects.msn
30 30 </%doc> 31 31 </tr> 32 32 % } 33 </table> 33 34 % } 34 35 </fieldset> 35 36 <%args> -
utf8/plugins/tag/comps/contenido/tag/components/block_tag_tabs.msn
1 1 <script> 2 2 $(function() { 3 var nActiveTab = getCookie( 'tag_tab_index' ) || 0; 3 4 $( "#tag_view_tabs" ).tabs({ 5 active: nActiveTab, 4 6 beforeLoad: function( event, ui ) { 5 7 ui.jqXHR.fail(function() { 6 8 ui.panel.html( 7 9 "Couldn't load this tab. We'll try to fix this as soon as possible. " + 8 10 "If this wouldn't be a demo." ); 9 11 }); 12 }, 13 activate: function( event, ui ) { 14 var nIndex = $(this).tabs( "option", "active" ); 15 setCookie( 'tag_tab_index', nIndex ); 10 16 } 11 17 }); 18 $( "#tag-search" ).autocomplete({ 19 minLength : 2, 20 source : '/contenido/ajax/document_search.html?class=tag::Tag', 21 select : function( event, ui ) 22 { 23 var item = ui.item; 24 $('#tag-search-id').val( item.id ); 25 $.ajax({ 26 'url' : '/contenido/tag/ajax/find.html', 27 'data' : { 'id' : item.id }, 28 'dataType' : 'json', 29 'success' : function( data ) { 30 if ( data.success ) { 31 $('#tag-found').html( data.html ); 32 } 33 } 34 }); 35 }, 36 change : function( event, ui ) 37 { 38 var sValue = $(this).val(); 39 if ( sValue == '' ) { 40 $('#tag-search-id').val(''); 41 $('#tag-found').html(''); 42 } 43 } 44 }); 45 $('form[name=tag-search-form]').on('submit', function( ev ){ 46 ev.preventDefault(); 47 var oForm = $(this)[0]; 48 var sValue = oForm.elements['tag_search'].value; 49 if ( sValue == '' ) { 50 $('#tag-search-id').val(''); 51 $('#tag-found').html(''); 52 } else { 53 $.ajax({ 54 'url' : '/contenido/tag/ajax/find.html', 55 'data' : { 'name' : sValue }, 56 'dataType' : 'json', 57 'success' : function( data ) { 58 if ( data.success ) { 59 $('#tag-found').html( data.html ); 60 } 61 } 62 }); 63 } 64 }); 12 65 }); 13 66 </script> 14 67 <div id="tag_view_tabs"> … … 20 73 % } 21 74 </ul> 22 75 <div id="tag_view_tabs-search"> 23 <p>Тут поисковая форма будет</p> 76 <form enctype="multipart/form-data" method="POST" name="tag-search-form"> 77 <input type="hidden" name="tag_search_id" id="tag-search-id" value="" autocomplete="off"> 78 <div class="form-field"> 79 <div class="prompt">Название тега:</div> 80 <input type="text" name="tag_search" id="tag-search" value="" autocomplete="off" style="width:85%; border:1px solid gray; padding:4px;"><input 81 type="submit" class="search_btn" value=""> 82 </div> 83 </form> 84 <div id="tag-found"></div> 24 85 </div> 25 86 </div> -
utf8/plugins/tag/comps/contenido/tag/components/form_tag_edit.msn
13 13 var sName = oForm.elements['name'].value; 14 14 var sAlias = oForm.elements['alias'].value; 15 15 var nStatus = oForm.elements['status'].value; 16 % if ( $state->{tag}->tag_structure eq 'tree' ) { 16 17 var nPid = oForm.elements['pid'].value; 18 % } else { 19 var nPid = 0; 20 % } 17 21 $('#tag-edit-error-prompt').hide(); 18 22 $.ajax({ 19 23 'url' : '/contenido/tag/ajax/tag_store.html', … … 62 66 <& /contenido/tag/components/inputs/tag_tree.msn, object => $object, name => 'pid', prop => $prop &> 63 67 % } 64 68 </div> 69 % if ( exists $props{abstr} ) { 70 % my $prop = $props{abstr}; 71 % my $type = $prop->{type}; 72 <div class="form-field"> 73 <div class="prompt"><% $prop->{rusname} %><span class="desc">| Attr=<% $prop->{attr} %>; Type=<% $prop->{type} %></span></div> 74 <& "/contenido/components/inputs/$type.msn", object => $object, prop => $prop, name => 'abstr', check => $object->abstr &> 75 </div> 76 % } 65 77 <div id="tag-edit-error-prompt" class="error-prompt" style="display:none;"></div> 66 78 <div class="form-submit"> 67 79 <input id="tag-edit-submit" type="button" class="input_btn" value="Сохранить"> -
utf8/plugins/tag/comps/contenido/tag/i/css/styles.css
15 15 .tag-plugin .error-prompt { margin:5px; padding:5px; } 16 16 17 17 .tag-plugin fieldset h3 { margin:5px 0; line-height:110%; } 18 .tag-plugin fieldset h3 span { font-weight:normal; color:gray; }