Commit f76beedf10848d0b4faeaa181a680322fbd54b7a
1 parent
d4a3f0fd
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
virtuoso: select a custom query when creating a new template
Showing
3 changed files
with
23 additions
and
1 deletions
Show diff stats
plugins/virtuoso/controllers/public/virtuoso_plugin_public_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
1 | +jQuery(document).ready(function($) { | |
2 | + $('#copy_custom_query').on('click', function() { | |
3 | + $.getJSON("/plugin/virtuoso/public/custom_query", {id: $('#select_custom_query').val()}, function(data) { | |
4 | + $('#article_query').val(data.custom_query.query); | |
5 | + tinymce.get('article_template').setContent(data.custom_query.template); | |
6 | + }); | |
7 | + }); | |
8 | +}); | ... | ... |
plugins/virtuoso/views/cms/virtuoso_plugin/_triples_template.html.erb
... | ... | @@ -4,8 +4,14 @@ |
4 | 4 | <%= render :file => 'shared/tiny_mce' %> |
5 | 5 | |
6 | 6 | <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> |
7 | - <%= labelled_form_field(_('SPARQL Query'), text_area(:article, :query, :style => 'width: 98%; height: 120px;')) %> | |
8 | 7 | |
8 | + <div class="custom-query"> | |
9 | + <span class="label"><%= _('Custom Query/Template selection: ') %></span> | |
10 | + <%= select_tag :select_custom_query, options_from_collection_for_select(environment.virtuoso_plugin_custom_queries, :id, :name) %> | |
11 | + <%= button :clone, _('Copy'), '#', :id => 'copy_custom_query' %> | |
12 | + </div> | |
13 | + | |
14 | + <%= labelled_form_field(_('SPARQL Query'), text_area(:article, :query, :style => 'width: 98%; height: 120px;')) %> | |
9 | 15 | <div class="template"> |
10 | 16 | <span class="label"><%= _('Template') %></span> |
11 | 17 | <span class="reference" style="float: right;"><a href="https://github.com/Shopify/liquid/wiki/Liquid-for-Designers"><%= _('Template reference') %></a></span> |
... | ... | @@ -17,3 +23,4 @@ |
17 | 23 | <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true} %> |
18 | 24 | <%= render :partial => 'general_fields' %> |
19 | 25 | </div> |
26 | +<%= javascript_include_tag '/plugins/virtuoso/custom_query.js' %> | ... | ... |