activeadmin-selleo-cms 0.0.51 → 0.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/admin/activeadmin_selleo_cms/page.rb +0 -1
- data/app/admin/translation.rb +8 -1
- data/app/assets/images/admin/edit.png +0 -0
- data/app/assets/images/admin/question_0.png +0 -0
- data/app/assets/images/admin/question_1.png +0 -0
- data/app/assets/images/admin/question_2.png +0 -0
- data/app/assets/images/admin/question_3.png +0 -0
- data/app/assets/images/admin/remove.png +0 -0
- data/app/assets/javascripts/activeadmin-selleo-cms/custom.js +1 -1
- data/app/assets/javascripts/ckeditor/plugins/formswidget/dialogs/formswidget.js +4 -3
- data/app/models/activeadmin_selleo_cms/form_question.rb +10 -3
- data/app/models/activeadmin_selleo_cms/form_question_option.rb +4 -0
- data/app/views/admin/form_questions/_form.html.haml +8 -7
- data/app/views/admin/forms/_form.html.haml +2 -2
- data/app/views/admin/translations/update.js.haml +1 -1
- data/app/views/forms/_form.html.erb +24 -12
- data/config/locales/cms.en.yml +8 -1
- data/lib/activeadmin-selleo-cms/version.rb +1 -1
- metadata +8 -2
data/app/admin/translation.rb
CHANGED
@@ -29,7 +29,14 @@ ActiveAdmin.register Translation do
|
|
29
29
|
|
30
30
|
controller do
|
31
31
|
def collection
|
32
|
-
|
32
|
+
_collection = get_collection_ivar
|
33
|
+
|
34
|
+
return _collection if _collection
|
35
|
+
|
36
|
+
_collection = find_collection.reorder(:key).select("DISTINCT(key)")
|
37
|
+
authorize! ActiveAdmin::Authorization::READ, active_admin_config.resource_class
|
38
|
+
|
39
|
+
set_collection_ivar _collection
|
33
40
|
end
|
34
41
|
end
|
35
42
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -99,7 +99,7 @@ function update_positions(pagesArray) {
|
|
99
99
|
}
|
100
100
|
|
101
101
|
$(function(){
|
102
|
-
$('#
|
102
|
+
$('#index_table_translations.index input').blur(function(evt){
|
103
103
|
$.ajax({
|
104
104
|
url: $(evt.target).data('route') + '.js',
|
105
105
|
type: 'PUT',
|
@@ -5,11 +5,12 @@ CKEDITOR.dialog.add( 'formswidgetDialog', function ( editor ) {
|
|
5
5
|
type: 'GET',
|
6
6
|
async: false,
|
7
7
|
success: function(resp){
|
8
|
-
items =
|
9
|
-
return [obj.title, obj.id]
|
10
|
-
})
|
8
|
+
items = $.map(resp, function(obj, idx) {
|
9
|
+
return [[obj.title, obj.id]]
|
10
|
+
})
|
11
11
|
}
|
12
12
|
});
|
13
|
+
debugger;
|
13
14
|
|
14
15
|
return {
|
15
16
|
title: 'Insert form',
|
@@ -4,8 +4,9 @@ module ActiveadminSelleoCms
|
|
4
4
|
TYPE_TEXT = 0
|
5
5
|
TYPE_SELECT = 1
|
6
6
|
TYPE_FILE = 2
|
7
|
-
|
8
|
-
|
7
|
+
TYPE_LABEL = 3
|
8
|
+
TYPES = [TYPE_TEXT, TYPE_SELECT, TYPE_FILE, TYPE_LABEL]
|
9
|
+
TYPE_NAMES = ["text question", "select question", "file upload", "label"]
|
9
10
|
|
10
11
|
belongs_to :form
|
11
12
|
has_many :options, class_name: "FormQuestionOption", :order => "position"
|
@@ -25,7 +26,7 @@ module ActiveadminSelleoCms
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def question_type_dictionary(int)
|
28
|
-
["text question", "select question", "file upload"][int]
|
29
|
+
["text question", "select question", "file upload", "label"][int]
|
29
30
|
end
|
30
31
|
|
31
32
|
end
|
@@ -57,6 +58,8 @@ module ActiveadminSelleoCms
|
|
57
58
|
:radio_button_tag
|
58
59
|
elsif question_type == TYPE_FILE
|
59
60
|
:file_field_tag
|
61
|
+
elsif question_type == TYPE_LABEL
|
62
|
+
:legend
|
60
63
|
end
|
61
64
|
end
|
62
65
|
|
@@ -70,6 +73,10 @@ module ActiveadminSelleoCms
|
|
70
73
|
end
|
71
74
|
end
|
72
75
|
|
76
|
+
def label
|
77
|
+
"#{title}#{'<i>'+I18n.t("active_admin.cms.forms.required")+'</i>' if is_required}".html_safe
|
78
|
+
end
|
79
|
+
|
73
80
|
end
|
74
81
|
|
75
82
|
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
= semantic_nested_form_for [:admin, @form, @form_question], url: (@form_question.new_record? ? admin_form_form_questions_path(@form.id) : admin_form_form_question_path(@form.id, @form_question.id)), remote: true, html: {id: "form_question_form"} do |form|
|
2
2
|
= form.inputs "Options" do
|
3
3
|
= form.input :title
|
4
|
-
= form.input :hint
|
5
|
-
= form.input :is_required
|
6
|
-
- unless @form_question.is_type?('file')
|
7
|
-
= form.input :is_multi
|
8
4
|
= form.input :question_type, as: :hidden
|
9
|
-
-
|
10
|
-
= form.input :
|
11
|
-
= form.input :
|
5
|
+
- unless @form_question.is_type?('label')
|
6
|
+
= form.input :hint
|
7
|
+
= form.input :is_required
|
8
|
+
- unless @form_question.is_type?('file')
|
9
|
+
= form.input :is_multi
|
10
|
+
- if @form_question.is_type?('select')
|
11
|
+
= form.input :has_other_option
|
12
|
+
= form.input :order, as: :hidden
|
12
13
|
|
13
14
|
- if @form_question.is_type?('select')
|
14
15
|
= form.inputs "Add options" do
|
@@ -24,7 +24,7 @@
|
|
24
24
|
},
|
25
25
|
|
26
26
|
receive:function (event, ui) {
|
27
|
-
$('#question_container').load("#{new_admin_form_form_question_url(@form)}?question_type="+$(ui.helper).attr("data-qtype")).dialog({modal:true, closeOnEscape: false});
|
27
|
+
$('#question_container').load("#{new_admin_form_form_question_url(@form)}?question_type="+$(ui.helper).attr("data-qtype")).dialog({modal:true, closeOnEscape: false, width: 800});
|
28
28
|
}
|
29
29
|
}).disableSelection();
|
30
30
|
|
@@ -46,5 +46,5 @@
|
|
46
46
|
}
|
47
47
|
|
48
48
|
function editQuestion(id){
|
49
|
-
$('#question_container').load("/admin/forms/#{@form.id}/form_questions/" + id + "/edit").dialog({modal:true, closeOnEscape: false});
|
49
|
+
$('#question_container').load("/admin/forms/#{@form.id}/form_questions/" + id + "/edit").dialog({modal:true, closeOnEscape: false, width: 800});
|
50
50
|
}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
- if @translation and @translation.update_attribute(:value, params[:value])
|
2
|
-
$('#
|
2
|
+
$('#index_table_translations.index input[data-locale="#{@translation.locale}"]').filter('[data-key="#{@translation.key}"]').closest('td').effect('highlight');
|
3
3
|
- else
|
4
4
|
alert('#{t("cms.errors.ajax.update.unknown_error")}');
|
@@ -1,18 +1,24 @@
|
|
1
|
+
<%= button_to_function t("active_admin.cms.forms.submit"), "deliver(#{form.id}, '#{dom_id(form)}')", class: 'send' %>
|
2
|
+
|
1
3
|
<%= form_tag '/forms', multipart: true, id: dom_id(form), data: {form_id: form.id} do %>
|
2
4
|
<ol class="questions">
|
3
5
|
<% form.questions.each do |question| %>
|
4
6
|
<li class="question <%= question.input_type %>">
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
|
8
|
+
<% unless question.input_type == :legend %>
|
9
|
+
<div class="questions_labels">
|
10
|
+
<%= label_tag dom_id(question), question.label %>
|
11
|
+
<% if question.hint.present? %>
|
12
|
+
<p class="hint"><%= question.hint %></p>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
11
17
|
<% if [:check_box_tag].include? question.input_type %>
|
12
18
|
<div class="questions_options">
|
13
19
|
<% question.options.each do |option| %>
|
14
20
|
<%= send(question.input_type, "#{dom_id(question)}[]", option.id, false, required: question.is_required, id: dom_id(option), data: {form_question_id: question.id} ) %>
|
15
|
-
<%= label_tag dom_id(option), option.
|
21
|
+
<%= label_tag dom_id(option), option.label %>
|
16
22
|
<% end %>
|
17
23
|
<%= text_field_tag "#{dom_id(question)}_other", "", data: {form_question_id: question.id} if question.has_other_option %>
|
18
24
|
</div>
|
@@ -20,12 +26,18 @@
|
|
20
26
|
<div class="questions_options">
|
21
27
|
<% question.options.each do |option| %>
|
22
28
|
<%= send(question.input_type, dom_id(question), option.id, false, required: question.is_required, id: dom_id(option), data: {form_question_id: question.id}) %>
|
23
|
-
<%= label_tag dom_id(option), option.
|
29
|
+
<%= label_tag dom_id(option), option.label %>
|
24
30
|
<% end %>
|
31
|
+
<%= label_tag "#{dom_id(question)}_other", t("active_admin.cms.forms.other") %>
|
25
32
|
<%= text_field_tag "#{dom_id(question)}_other", "", data: {form_question_id: question.id} if question.has_other_option %>
|
26
33
|
</div>
|
27
34
|
<% elsif [:file_field_tag].include? question.input_type %>
|
28
|
-
|
35
|
+
<div class="file_upload" data-question-id="<%= question.id %>">
|
36
|
+
<p></p>
|
37
|
+
<%= button_to_function t("active_admin.cms.forms.select_file"), "fileUpload('#{dom_id(form)}', '#{dom_id(question)}', #{question.id})", style: "padding: 5px;" %>
|
38
|
+
</div>
|
39
|
+
<% elsif question.input_type == :legend %>
|
40
|
+
<legend><%= question.label %></legend>
|
29
41
|
<% else %>
|
30
42
|
<%= send(question.input_type, dom_id(question), "", required: question.is_required, data: {form_question_id: question.id}) %>
|
31
43
|
<% end %>
|
@@ -34,9 +46,9 @@
|
|
34
46
|
</ol>
|
35
47
|
<% end %>
|
36
48
|
|
37
|
-
<%= button_to_function "
|
38
|
-
<%= button_to_function "
|
39
|
-
<%= button_to_function "
|
49
|
+
<%= button_to_function "", "print(#{form.id}, '#{dom_id(form)}')", class: 'print', title: t("active_admin.cms.forms.print") %>
|
50
|
+
<%= button_to_function "", "downloadPDF(#{form.id}, '#{dom_id(form)}')", class: 'save', title: t("active_admin.cms.forms.pdf") %>
|
51
|
+
<%= button_to_function t("active_admin.cms.forms.submit"), "deliver(#{form.id}, '#{dom_id(form)}')", class: 'send' %>
|
40
52
|
|
41
53
|
<script>
|
42
54
|
$(function(){
|
data/config/locales/cms.en.yml
CHANGED
@@ -34,4 +34,11 @@ en:
|
|
34
34
|
edit_image: "Edit image"
|
35
35
|
edit_related_item: "Edit related"
|
36
36
|
hint: "Hint: drag and drop files to reorder them"
|
37
|
-
no_cover: "No cover image"
|
37
|
+
no_cover: "No cover image"
|
38
|
+
forms:
|
39
|
+
submit: "Submit form"
|
40
|
+
print: "Print"
|
41
|
+
pdf: "Download PDF"
|
42
|
+
select_file: "Select file"
|
43
|
+
other: "Other"
|
44
|
+
required: " (required)"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin-selleo-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.52
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -441,6 +441,12 @@ files:
|
|
441
441
|
- app/assets/stylesheets/active_admin/jquery-ui.css.scss
|
442
442
|
- app/assets/stylesheets/active_admin/cms.css.scss
|
443
443
|
- app/assets/stylesheets/active_admin/jquery.Jcrop.css
|
444
|
+
- app/assets/images/admin/question_2.png
|
445
|
+
- app/assets/images/admin/edit.png
|
446
|
+
- app/assets/images/admin/question_0.png
|
447
|
+
- app/assets/images/admin/remove.png
|
448
|
+
- app/assets/images/admin/question_3.png
|
449
|
+
- app/assets/images/admin/question_1.png
|
444
450
|
- app/assets/images/activeadmin-selleo-cms/Jcrop.gif
|
445
451
|
- app/assets/javascripts/active_admin.js
|
446
452
|
- app/assets/javascripts/ckeditor/config.js
|