Commit 03e838f138fcd04e08ff22d9e2863f1a24e72203
Exists in
master
and in
6 other branches
Merge branch 'site_tour' into 'master'
Add site_tour plugin from gitlab.com/noosfero-plugins/site_tour See merge request !654
Showing
29 changed files
with
971 additions
and
0 deletions
Show diff stats
plugins/site_tour/controllers/public/site_tour_plugin_public_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,11 @@ |
1 | +class SiteTourPluginPublicController < PublicController | |
2 | + | |
3 | + before_filter :login_required | |
4 | + | |
5 | + def mark_action | |
6 | + user.site_tour_plugin_actions += [params[:action_name]].flatten | |
7 | + user.site_tour_plugin_actions.uniq! | |
8 | + render :json => {:ok => user.save} | |
9 | + end | |
10 | + | |
11 | +end | ... | ... |
plugins/site_tour/controllers/site_tour_plugin_admin_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,50 @@ |
1 | +require 'csv' | |
2 | + | |
3 | +class SiteTourPluginAdminController < PluginAdminController | |
4 | + | |
5 | + no_design_blocks | |
6 | + | |
7 | + def index | |
8 | + settings = params[:settings] | |
9 | + settings ||= {} | |
10 | + | |
11 | + @settings = Noosfero::Plugin::Settings.new(environment, SiteTourPlugin, settings) | |
12 | + @settings.actions_csv = convert_to_csv(@settings.actions) | |
13 | + @settings.group_triggers_csv = convert_to_csv(@settings.group_triggers) | |
14 | + | |
15 | + if request.post? | |
16 | + @settings.actions = convert_actions_from_csv(settings[:actions_csv]) | |
17 | + @settings.settings.delete(:actions_csv) | |
18 | + | |
19 | + @settings.group_triggers = convert_group_triggers_from_csv(settings[:group_triggers_csv]) | |
20 | + @settings.settings.delete(:group_triggers_csv) | |
21 | + | |
22 | + @settings.save! | |
23 | + session[:notice] = 'Settings succefully saved.' | |
24 | + redirect_to :action => 'index' | |
25 | + end | |
26 | + end | |
27 | + | |
28 | + protected | |
29 | + | |
30 | + def convert_to_csv(actions) | |
31 | + CSV.generate do |csv| | |
32 | + (actions||[]).each { |action| csv << action.values } | |
33 | + end | |
34 | + end | |
35 | + | |
36 | + def convert_actions_from_csv(actions_csv) | |
37 | + return [] if actions_csv.blank? | |
38 | + CSV.parse(actions_csv).map do |action| | |
39 | + {:language => action[0], :group_name => action[1], :selector => action[2], :description => action[3]} | |
40 | + end | |
41 | + end | |
42 | + | |
43 | + def convert_group_triggers_from_csv(group_triggers_csv) | |
44 | + return [] if group_triggers_csv.blank? | |
45 | + CSV.parse(group_triggers_csv).map do |group| | |
46 | + {:group_name => group[0], :selector => group[1], :event => group[2]} | |
47 | + end | |
48 | + end | |
49 | + | |
50 | +end | ... | ... |
... | ... | @@ -0,0 +1,44 @@ |
1 | +class SiteTourPlugin < Noosfero::Plugin | |
2 | + | |
3 | + def self.plugin_name | |
4 | + 'SiteTourPlugin' | |
5 | + end | |
6 | + | |
7 | + def self.plugin_description | |
8 | + _("A site tour to show users how to use the application.") | |
9 | + end | |
10 | + | |
11 | + def stylesheet? | |
12 | + true | |
13 | + end | |
14 | + | |
15 | + def js_files | |
16 | + ['intro.min.js', 'main.js'] | |
17 | + end | |
18 | + | |
19 | + def user_data_extras | |
20 | + proc do | |
21 | + logged_in? ? {:site_tour_plugin_actions => user.site_tour_plugin_actions}:{} | |
22 | + end | |
23 | + end | |
24 | + | |
25 | + def body_ending | |
26 | + proc do | |
27 | + tour_file = "/plugins/site_tour/tour/#{language}/tour.js" | |
28 | + js_file = File.exists?(Rails.root.join("public#{tour_file}").to_s) ? tour_file : "" | |
29 | + settings = Noosfero::Plugin::Settings.new(environment, SiteTourPlugin) | |
30 | + actions = (settings.actions||[]).select {|action| action[:language] == language} | |
31 | + | |
32 | + render(:file => 'tour_actions', :locals => { :actions => actions, :group_triggers => settings.group_triggers, :js_file => js_file}) | |
33 | + end | |
34 | + end | |
35 | + | |
36 | + def self.extra_blocks | |
37 | + { SiteTourPlugin::TourBlock => {} } | |
38 | + end | |
39 | + | |
40 | + def self.actions_csv_default_setting | |
41 | + 'en,tour_plugin,.site-tour-plugin_tour-block .tour-button,"Click to start tour!"' | |
42 | + end | |
43 | + | |
44 | +end | ... | ... |
plugins/site_tour/lib/site_tour_plugin/site_tour_helper.rb
0 → 100644
... | ... | @@ -0,0 +1,14 @@ |
1 | +module SiteTourPlugin::SiteTourHelper | |
2 | + | |
3 | + def parse_tour_description(description) | |
4 | + p = profile rescue nil | |
5 | + if !p.nil? && description.present? | |
6 | + description.gsub('{profile.identifier}', p.identifier). | |
7 | + gsub('{profile.name}', p.name). | |
8 | + gsub('{profile.url}', url_for(p.url)) | |
9 | + else | |
10 | + description | |
11 | + end | |
12 | + end | |
13 | + | |
14 | +end | ... | ... |
... | ... | @@ -0,0 +1,29 @@ |
1 | +class SiteTourPlugin::TourBlock < Block | |
2 | + | |
3 | + settings_items :actions, :type => Array, :default => [{:group_name => 'tour_plugin', :selector => '.site-tour-plugin_tour-block .tour-button', :description => _('Click to start tour!')}] | |
4 | + settings_items :group_triggers, :type => Array, :default => [] | |
5 | + settings_items :display_button, :type => :boolean, :default => true | |
6 | + | |
7 | + attr_accessible :actions, :display_button, :group_triggers | |
8 | + | |
9 | + before_save do |block| | |
10 | + block.actions.reject! {|i| i[:group_name].blank? && i[:selector].blank? && i[:description].blank?} | |
11 | + block.group_triggers.reject! {|i| i[:group_name].blank? && i[:selector].blank?} | |
12 | + end | |
13 | + | |
14 | + def self.description | |
15 | + _('Site Tour Block') | |
16 | + end | |
17 | + | |
18 | + def help | |
19 | + _('Configure a step-by-step tour.') | |
20 | + end | |
21 | + | |
22 | + def content(args={}) | |
23 | + block = self | |
24 | + proc do | |
25 | + render :file => 'blocks/tour', :locals => {:block => block} | |
26 | + end | |
27 | + end | |
28 | + | |
29 | +end | ... | ... |
... | ... | @@ -0,0 +1,119 @@ |
1 | +msgid "" | |
2 | +msgstr "" | |
3 | +"Project-Id-Version: 1.2~rc1-2843-g999a037\n" | |
4 | +"POT-Creation-Date: 2015-08-06 08:53-0300\n" | |
5 | +"PO-Revision-Date: 2015-02-03 17:27-0300\n" | |
6 | +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
7 | +"Language-Team: LANGUAGE <LL@li.org>\n" | |
8 | +"Language: \n" | |
9 | +"MIME-Version: 1.0\n" | |
10 | +"Content-Type: text/plain; charset=UTF-8\n" | |
11 | +"Content-Transfer-Encoding: 8bit\n" | |
12 | +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" | |
13 | + | |
14 | +#: plugins/site_tour/lib/site_tour_plugin.rb:8 | |
15 | +msgid "A site tour to show users how to use the application." | |
16 | +msgstr "Um plugin para apresentar aos usuários um tour da aplicação" | |
17 | + | |
18 | +#: plugins/site_tour/lib/site_tour_plugin/tour_block.rb:3 | |
19 | +msgid "Click to start tour!" | |
20 | +msgstr "Clique para iniciar o tour!" | |
21 | + | |
22 | +#: plugins/site_tour/lib/site_tour_plugin/tour_block.rb:15 | |
23 | +msgid "Site Tour Block" | |
24 | +msgstr "Bloco para Site Tour" | |
25 | + | |
26 | +#: plugins/site_tour/lib/site_tour_plugin/tour_block.rb:19 | |
27 | +msgid "Configure a step-by-step tour." | |
28 | +msgstr "Configure o passo a passo do tour." | |
29 | + | |
30 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block_item.html.erb:13 | |
31 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block_group_item.html.erb:15 | |
32 | +msgid "Delete" | |
33 | +msgstr "Apagar" | |
34 | + | |
35 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:4 | |
36 | +msgid "Display help button" | |
37 | +msgstr "Mostrar o botão de ajuda" | |
38 | + | |
39 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:8 | |
40 | +msgid "Tooltip Actions" | |
41 | +msgstr "Ações do Tooltip" | |
42 | + | |
43 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:9 | |
44 | +msgid "" | |
45 | +"Special fields for description: {profile.name}, {profile.identifier}, " | |
46 | +"{profile.url}." | |
47 | +msgstr "" | |
48 | +"Campos especiais para a descrição: {profile.name}, {profile.identifier}, " | |
49 | +"{profile.url}" | |
50 | + | |
51 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:11 | |
52 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:29 | |
53 | +msgid "Group Name" | |
54 | +msgstr "Nome do Grupo" | |
55 | + | |
56 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:12 | |
57 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:30 | |
58 | +msgid "Selector" | |
59 | +msgstr "Seletor" | |
60 | + | |
61 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:13 | |
62 | +msgid "Description" | |
63 | +msgstr "Descrição" | |
64 | + | |
65 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:23 | |
66 | +msgid "New Tooltip" | |
67 | +msgstr "Novo Tooltip" | |
68 | + | |
69 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:27 | |
70 | +msgid "Group Triggers" | |
71 | +msgstr "Gatilhos dos Grupos" | |
72 | + | |
73 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:31 | |
74 | +msgid "Event" | |
75 | +msgstr "Evento" | |
76 | + | |
77 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:41 | |
78 | +msgid "New Group Trigger" | |
79 | +msgstr "Novo Gatilho de Grupo" | |
80 | + | |
81 | +#: plugins/site_tour/views/blocks/tour.html.erb:4 | |
82 | +msgid "Help" | |
83 | +msgstr "Ajuda" | |
84 | + | |
85 | +#: plugins/site_tour/views/tour_actions.html.erb:16 | |
86 | +msgid "Next" | |
87 | +msgstr "Próximo" | |
88 | + | |
89 | +#: plugins/site_tour/views/tour_actions.html.erb:17 | |
90 | +msgid "Back" | |
91 | +msgstr "Anterior" | |
92 | + | |
93 | +#: plugins/site_tour/views/tour_actions.html.erb:18 | |
94 | +msgid "Skip" | |
95 | +msgstr "Pular" | |
96 | + | |
97 | +#: plugins/site_tour/views/tour_actions.html.erb:19 | |
98 | +msgid "Finish" | |
99 | +msgstr "Fim" | |
100 | + | |
101 | +#: plugins/site_tour/views/site_tour_plugin_admin/index.html.erb:1 | |
102 | +msgid "Site Tour Settings" | |
103 | +msgstr "Configurações do Site Tour" | |
104 | + | |
105 | +#: plugins/site_tour/views/site_tour_plugin_admin/index.html.erb:5 | |
106 | +msgid "Tooltips (CSV format: language, group name, selector, description)" | |
107 | +msgstr "Tooltips (Formato CSV: idioma, nome do grupo, seletor, descrição)" | |
108 | + | |
109 | +#: plugins/site_tour/views/site_tour_plugin_admin/index.html.erb:6 | |
110 | +msgid "" | |
111 | +"Group Triggers (CSV format: group name, selector, event (e.g. mouseenter, " | |
112 | +"click))" | |
113 | +msgstr "" | |
114 | +"Gatilhos dos grupos (Formato CSV: nome do grupo, seletor, evento (e.g. " | |
115 | +"mouseenter, click))" | |
116 | + | |
117 | +#: plugins/site_tour/views/site_tour_plugin_admin/index.html.erb:9 | |
118 | +msgid "Save" | |
119 | +msgstr "Salvar" | ... | ... |
... | ... | @@ -0,0 +1,121 @@ |
1 | +# SOME DESCRIPTIVE TITLE. | |
2 | +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | |
3 | +# This file is distributed under the same license as the PACKAGE package. | |
4 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
5 | +# | |
6 | +#, fuzzy | |
7 | +msgid "" | |
8 | +msgstr "" | |
9 | +"Project-Id-Version: 1.2~rc1-2843-g999a037\n" | |
10 | +"POT-Creation-Date: 2015-08-06 08:53-0300\n" | |
11 | +"PO-Revision-Date: 2015-02-03 17:27-0300\n" | |
12 | +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
13 | +"Language-Team: LANGUAGE <LL@li.org>\n" | |
14 | +"Language: \n" | |
15 | +"MIME-Version: 1.0\n" | |
16 | +"Content-Type: text/plain; charset=UTF-8\n" | |
17 | +"Content-Transfer-Encoding: 8bit\n" | |
18 | +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" | |
19 | + | |
20 | +#: plugins/site_tour/lib/site_tour_plugin.rb:8 | |
21 | +msgid "A site tour to show users how to use the application." | |
22 | +msgstr "" | |
23 | + | |
24 | +#: plugins/site_tour/lib/site_tour_plugin/tour_block.rb:3 | |
25 | +msgid "Click to start tour!" | |
26 | +msgstr "" | |
27 | + | |
28 | +#: plugins/site_tour/lib/site_tour_plugin/tour_block.rb:15 | |
29 | +msgid "Site Tour Block" | |
30 | +msgstr "" | |
31 | + | |
32 | +#: plugins/site_tour/lib/site_tour_plugin/tour_block.rb:19 | |
33 | +msgid "Configure a step-by-step tour." | |
34 | +msgstr "" | |
35 | + | |
36 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block_item.html.erb:13 | |
37 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block_group_item.html.erb:15 | |
38 | +msgid "Delete" | |
39 | +msgstr "" | |
40 | + | |
41 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:4 | |
42 | +msgid "Display help button" | |
43 | +msgstr "" | |
44 | + | |
45 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:8 | |
46 | +msgid "Tooltip Actions" | |
47 | +msgstr "" | |
48 | + | |
49 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:9 | |
50 | +msgid "" | |
51 | +"Special fields for description: {profile.name}, {profile.identifier}, " | |
52 | +"{profile.url}." | |
53 | +msgstr "" | |
54 | + | |
55 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:11 | |
56 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:29 | |
57 | +msgid "Group Name" | |
58 | +msgstr "" | |
59 | + | |
60 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:12 | |
61 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:30 | |
62 | +msgid "Selector" | |
63 | +msgstr "" | |
64 | + | |
65 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:13 | |
66 | +msgid "Description" | |
67 | +msgstr "" | |
68 | + | |
69 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:23 | |
70 | +msgid "New Tooltip" | |
71 | +msgstr "" | |
72 | + | |
73 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:27 | |
74 | +msgid "Group Triggers" | |
75 | +msgstr "" | |
76 | + | |
77 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:31 | |
78 | +msgid "Event" | |
79 | +msgstr "" | |
80 | + | |
81 | +#: plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb:41 | |
82 | +msgid "New Group Trigger" | |
83 | +msgstr "" | |
84 | + | |
85 | +#: plugins/site_tour/views/blocks/tour.html.erb:4 | |
86 | +msgid "Help" | |
87 | +msgstr "" | |
88 | + | |
89 | +#: plugins/site_tour/views/tour_actions.html.erb:16 | |
90 | +msgid "Next" | |
91 | +msgstr "" | |
92 | + | |
93 | +#: plugins/site_tour/views/tour_actions.html.erb:17 | |
94 | +msgid "Back" | |
95 | +msgstr "" | |
96 | + | |
97 | +#: plugins/site_tour/views/tour_actions.html.erb:18 | |
98 | +msgid "Skip" | |
99 | +msgstr "" | |
100 | + | |
101 | +#: plugins/site_tour/views/tour_actions.html.erb:19 | |
102 | +msgid "Finish" | |
103 | +msgstr "" | |
104 | + | |
105 | +#: plugins/site_tour/views/site_tour_plugin_admin/index.html.erb:1 | |
106 | +msgid "Site Tour Settings" | |
107 | +msgstr "" | |
108 | + | |
109 | +#: plugins/site_tour/views/site_tour_plugin_admin/index.html.erb:5 | |
110 | +msgid "Tooltips (CSV format: language, group name, selector, description)" | |
111 | +msgstr "" | |
112 | + | |
113 | +#: plugins/site_tour/views/site_tour_plugin_admin/index.html.erb:6 | |
114 | +msgid "" | |
115 | +"Group Triggers (CSV format: group name, selector, event (e.g. mouseenter, " | |
116 | +"click))" | |
117 | +msgstr "" | |
118 | + | |
119 | +#: plugins/site_tour/views/site_tour_plugin_admin/index.html.erb:9 | |
120 | +msgid "Save" | |
121 | +msgstr "" | ... | ... |
... | ... | @@ -0,0 +1,73 @@ |
1 | +#edit-tour-block #tooltip-actions h3 { | |
2 | + margin-bottom: 5px; | |
3 | +} | |
4 | + | |
5 | +#edit-tour-block .special-attributes { | |
6 | + color: rgb(157, 157, 157); | |
7 | +} | |
8 | + | |
9 | +#edit-tour-block .list-items { | |
10 | + margin-bottom: 25px; | |
11 | +} | |
12 | + | |
13 | +#edit-tour-block .droppable-items { | |
14 | + padding-left: 0; | |
15 | + margin-top: -12px; | |
16 | +} | |
17 | + | |
18 | +#edit-tour-block .droppable-items li { | |
19 | + list-style-type: none; | |
20 | +} | |
21 | + | |
22 | +#edit-tour-block .item-row { | |
23 | + line-height: 25px; | |
24 | + margin-bottom: 5px; | |
25 | + padding: 0; | |
26 | + cursor: pointer; | |
27 | + width: 97%; | |
28 | +} | |
29 | + | |
30 | +#edit-tour-block .item-row:hover { | |
31 | + background: #ddd url(/images/drag-and-drop.png) no-repeat; | |
32 | + background-position: 98% 15px; | |
33 | +} | |
34 | + | |
35 | +#edit-tour-block .item-row li { | |
36 | + list-style-type: none; | |
37 | + display: inline; | |
38 | + margin-left: 5px; | |
39 | +} | |
40 | + | |
41 | +#edit-tour-block { | |
42 | + width: 620px; | |
43 | + position: relative; | |
44 | +} | |
45 | + | |
46 | +#edit-tour-block #new-template { | |
47 | + display: none; | |
48 | +} | |
49 | + | |
50 | +#edit-tour-block .list-header { | |
51 | + width: 98%; | |
52 | + padding: 0 1px 10px 10px; | |
53 | + margin-bottom: 5px; | |
54 | + cursor: pointer; | |
55 | +} | |
56 | + | |
57 | +#edit-tour-block .list-header li { | |
58 | + list-style-type: none; | |
59 | + display: inline; | |
60 | + font-weight: bold; | |
61 | + font-size: 12px; | |
62 | + text-align: center; | |
63 | +} | |
64 | + | |
65 | +#edit-tour-block .list-header .list-name { | |
66 | + margin-left: 20px; | |
67 | +} | |
68 | +#edit-tour-block .list-header .list-selector { | |
69 | + margin-left: 63px; | |
70 | +} | |
71 | +#edit-tour-block .list-header .list-description, #edit-tour-block .list-header .list-event { | |
72 | + margin-left: 68px; | |
73 | +} | ... | ... |
... | ... | @@ -0,0 +1,18 @@ |
1 | +jQuery(document).ready(function(){ | |
2 | + jQuery('#edit-tour-block').on('click', '.add-item', function() { | |
3 | + var container = jQuery(this).closest('.list-items'); | |
4 | + var new_action = container.find('#new-template>li').clone(); | |
5 | + new_action.show(); | |
6 | + container.find('.droppable-items').append(new_action); | |
7 | + }); | |
8 | + | |
9 | + jQuery('#edit-tour-block').on('click', '.delete-tour-block-item', function() { | |
10 | + jQuery(this).parent().parent().remove(); | |
11 | + return false; | |
12 | + }); | |
13 | + | |
14 | + jQuery("#edit-tour-block .droppable-items").sortable({ | |
15 | + revert: true, | |
16 | + axis: "y" | |
17 | + }); | |
18 | +}); | ... | ... |
... | ... | @@ -0,0 +1,33 @@ |
1 | +(function(w,p){"object"===typeof exports?p(exports):"function"===typeof define&&define.amd?define(["exports"],p):p(w)})(this,function(w){function p(a){this._targetElement=a;this._options={nextLabel:"Next →",prevLabel:"← Back",skipLabel:"Skip",doneLabel:"Done",tooltipPosition:"bottom",tooltipClass:"",highlightClass:"",exitOnEsc:!0,exitOnOverlayClick:!0,showStepNumbers:!0,keyboardNavigation:!0,showButtons:!0,showBullets:!0,showProgress:!1,scrollToElement:!0,overlayOpacity:0.8,positionPrecedence:["bottom", | |
2 | +"top","right","left"],disableInteraction:!1}}function J(a){var b=[],c=this;if(this._options.steps)for(var d=[],e=0,d=this._options.steps.length;e<d;e++){var f=A(this._options.steps[e]);f.step=b.length+1;"string"===typeof f.element&&(f.element=document.querySelector(f.element));if("undefined"===typeof f.element||null==f.element){var h=document.querySelector(".introjsFloatingElement");null==h&&(h=document.createElement("div"),h.className="introjsFloatingElement",document.body.appendChild(h));f.element= | |
3 | +h;f.position="floating"}null!=f.element&&b.push(f)}else{d=a.querySelectorAll("*[data-intro]");if(1>d.length)return!1;e=0;for(f=d.length;e<f;e++){var h=d[e],k=parseInt(h.getAttribute("data-step"),10);0<k&&(b[k-1]={element:h,intro:h.getAttribute("data-intro"),step:parseInt(h.getAttribute("data-step"),10),tooltipClass:h.getAttribute("data-tooltipClass"),highlightClass:h.getAttribute("data-highlightClass"),position:h.getAttribute("data-position")||this._options.tooltipPosition})}e=k=0;for(f=d.length;e< | |
4 | +f;e++)if(h=d[e],null==h.getAttribute("data-step")){for(;"undefined"!=typeof b[k];)k++;b[k]={element:h,intro:h.getAttribute("data-intro"),step:k+1,tooltipClass:h.getAttribute("data-tooltipClass"),highlightClass:h.getAttribute("data-highlightClass"),position:h.getAttribute("data-position")||this._options.tooltipPosition}}}e=[];for(d=0;d<b.length;d++)b[d]&&e.push(b[d]);b=e;b.sort(function(a,b){return a.step-b.step});c._introItems=b;K.call(c,a)&&(x.call(c),a.querySelector(".introjs-skipbutton"),a.querySelector(".introjs-nextbutton"), | |
5 | +c._onKeyDown=function(b){if(27===b.keyCode&&!0==c._options.exitOnEsc)y.call(c,a),void 0!=c._introExitCallback&&c._introExitCallback.call(c);else if(37===b.keyCode)C.call(c);else if(39===b.keyCode)x.call(c);else if(13===b.keyCode){var d=b.target||b.srcElement;d&&0<d.className.indexOf("introjs-prevbutton")?C.call(c):d&&0<d.className.indexOf("introjs-skipbutton")?y.call(c,a):x.call(c);b.preventDefault?b.preventDefault():b.returnValue=!1}},c._onResize=function(a){t.call(c,document.querySelector(".introjs-helperLayer")); | |
6 | +t.call(c,document.querySelector(".introjs-tooltipReferenceLayer"))},window.addEventListener?(this._options.keyboardNavigation&&window.addEventListener("keydown",c._onKeyDown,!0),window.addEventListener("resize",c._onResize,!0)):document.attachEvent&&(this._options.keyboardNavigation&&document.attachEvent("onkeydown",c._onKeyDown),document.attachEvent("onresize",c._onResize)));return!1}function A(a){if(null==a||"object"!=typeof a||"undefined"!=typeof a.nodeType)return a;var b={},c;for(c in a)b[c]= | |
7 | +A(a[c]);return b}function x(){this._direction="forward";"undefined"===typeof this._currentStep?this._currentStep=0:++this._currentStep;if(this._introItems.length<=this._currentStep)"function"===typeof this._introCompleteCallback&&this._introCompleteCallback.call(this),y.call(this,this._targetElement);else{var a=this._introItems[this._currentStep];"undefined"!==typeof this._introBeforeChangeCallback&&this._introBeforeChangeCallback.call(this,a.element);G.call(this,a)}}function C(){this._direction= | |
8 | +"backward";if(0===this._currentStep)return!1;var a=this._introItems[--this._currentStep];"undefined"!==typeof this._introBeforeChangeCallback&&this._introBeforeChangeCallback.call(this,a.element);G.call(this,a)}function y(a){var b=a.querySelector(".introjs-overlay");if(null!=b){b.style.opacity=0;setTimeout(function(){b.parentNode&&b.parentNode.removeChild(b)},500);var c=a.querySelector(".introjs-helperLayer");c&&c.parentNode.removeChild(c);(c=a.querySelector(".introjs-tooltipReferenceLayer"))&&c.parentNode.removeChild(c); | |
9 | +(a=a.querySelector(".introjs-disableInteraction"))&&a.parentNode.removeChild(a);(a=document.querySelector(".introjsFloatingElement"))&&a.parentNode.removeChild(a);if(a=document.querySelector(".introjs-showElement"))a.className=a.className.replace(/introjs-[a-zA-Z]+/g,"").replace(/^\s+|\s+$/g,"");if((a=document.querySelectorAll(".introjs-fixParent"))&&0<a.length)for(c=a.length-1;0<=c;c--)a[c].className=a[c].className.replace(/introjs-fixParent/g,"").replace(/^\s+|\s+$/g,"");window.removeEventListener? | |
10 | +window.removeEventListener("keydown",this._onKeyDown,!0):document.detachEvent&&document.detachEvent("onkeydown",this._onKeyDown);this._currentStep=void 0}}function H(a,b,c,d){var e="";b.style.top=null;b.style.right=null;b.style.bottom=null;b.style.left=null;b.style.marginLeft=null;b.style.marginTop=null;c.style.display="inherit";"undefined"!=typeof d&&null!=d&&(d.style.top=null,d.style.left=null);if(this._introItems[this._currentStep]){e=this._introItems[this._currentStep];e="string"===typeof e.tooltipClass? | |
11 | +e.tooltipClass:this._options.tooltipClass;b.className=("introjs-tooltip "+e).replace(/^\s+|\s+$/g,"");currentTooltipPosition=this._introItems[this._currentStep].position;if(("auto"==currentTooltipPosition||"auto"==this._options.tooltipPosition)&&"floating"!=currentTooltipPosition){var e=currentTooltipPosition,f=this._options.positionPrecedence.slice(),h=F(),p=k(b).height+10,s=k(b).width+20,l=k(a),m="floating";l.left+s>h.width||0>l.left+l.width/2-s?(q(f,"bottom"),q(f,"top")):(l.height+l.top+p>h.height&& | |
12 | +q(f,"bottom"),0>l.top-p&&q(f,"top"));l.width+l.left+s>h.width&&q(f,"right");0>l.left-s&&q(f,"left");0<f.length&&(m=f[0]);e&&"auto"!=e&&-1<f.indexOf(e)&&(m=e);currentTooltipPosition=m}e=k(a);f=k(b).height;h=F();switch(currentTooltipPosition){case "top":b.style.left="15px";b.style.top="-"+(f+10)+"px";c.className="introjs-arrow bottom";break;case "right":b.style.left=k(a).width+20+"px";e.top+f>h.height&&(c.className="introjs-arrow left-bottom",b.style.top="-"+(f-e.height-20)+"px");c.className="introjs-arrow left"; | |
13 | +break;case "left":!0==this._options.showStepNumbers&&(b.style.top="15px");e.top+f>h.height?(b.style.top="-"+(f-e.height-20)+"px",c.className="introjs-arrow right-bottom"):c.className="introjs-arrow right";b.style.right=e.width+20+"px";break;case "floating":c.style.display="none";a=k(b);b.style.left="50%";b.style.top="50%";b.style.marginLeft="-"+a.width/2+"px";b.style.marginTop="-"+a.height/2+"px";"undefined"!=typeof d&&null!=d&&(d.style.left="-"+(a.width/2+18)+"px",d.style.top="-"+(a.height/2+18)+ | |
14 | +"px");break;case "bottom-right-aligned":c.className="introjs-arrow top-right";b.style.right="0px";b.style.bottom="-"+(k(b).height+10)+"px";break;case "bottom-middle-aligned":d=k(a);a=k(b);c.className="introjs-arrow top-middle";b.style.left=d.width/2-a.width/2+"px";b.style.bottom="-"+(a.height+10)+"px";break;default:b.style.bottom="-"+(k(b).height+10)+"px",b.style.left=k(a).width/2-k(b).width/2+"px",c.className="introjs-arrow top"}}}function q(a,b){-1<a.indexOf(b)&&a.splice(a.indexOf(b),1)}function t(a){if(a&& | |
15 | +this._introItems[this._currentStep]){var b=this._introItems[this._currentStep],c=k(b.element),d=10;"floating"==b.position&&(d=0);a.setAttribute("style","width: "+(c.width+d)+"px; height:"+(c.height+d)+"px; top:"+(c.top-5)+"px;left: "+(c.left-5)+"px;")}}function L(){var a=document.querySelector(".introjs-disableInteraction");null===a&&(a=document.createElement("div"),a.className="introjs-disableInteraction",this._targetElement.appendChild(a));t.call(this,a)}function G(a){"undefined"!==typeof this._introChangeCallback&& | |
16 | +this._introChangeCallback.call(this,a.element);var b=this,c=document.querySelector(".introjs-helperLayer"),d=document.querySelector(".introjs-tooltipReferenceLayer"),e="introjs-helperLayer";k(a.element);"string"===typeof a.highlightClass&&(e+=" "+a.highlightClass);"string"===typeof this._options.highlightClass&&(e+=" "+this._options.highlightClass);if(null!=c){var f=d.querySelector(".introjs-helperNumberLayer"),h=d.querySelector(".introjs-tooltiptext"),p=d.querySelector(".introjs-arrow"),s=d.querySelector(".introjs-tooltip"), | |
17 | +l=d.querySelector(".introjs-skipbutton"),m=d.querySelector(".introjs-prevbutton"),r=d.querySelector(".introjs-nextbutton");c.className=e;s.style.opacity=0;s.style.display="none";if(null!=f){var g=this._introItems[0<=a.step-2?a.step-2:0];if(null!=g&&"forward"==this._direction&&"floating"==g.position||"backward"==this._direction&&"floating"==a.position)f.style.opacity=0}t.call(b,c);t.call(b,d);if((g=document.querySelectorAll(".introjs-fixParent"))&&0<g.length)for(e=g.length-1;0<=e;e--)g[e].className= | |
18 | +g[e].className.replace(/introjs-fixParent/g,"").replace(/^\s+|\s+$/g,"");g=document.querySelector(".introjs-showElement");g.className=g.className.replace(/introjs-[a-zA-Z]+/g,"").replace(/^\s+|\s+$/g,"");b._lastShowElementTimer&&clearTimeout(b._lastShowElementTimer);b._lastShowElementTimer=setTimeout(function(){null!=f&&(f.innerHTML=a.step);h.innerHTML=a.intro;s.style.display="block";H.call(b,a.element,s,p,f);d.querySelector(".introjs-bullets li > a.active").className="";d.querySelector('.introjs-bullets li > a[data-stepnumber="'+ | |
19 | +a.step+'"]').className="active";d.querySelector(".introjs-progress .introjs-progressbar").setAttribute("style","width:"+I.call(b)+"%;");s.style.opacity=1;f&&(f.style.opacity=1);-1===r.tabIndex?l.focus():r.focus()},350)}else{var q=document.createElement("div"),m=document.createElement("div"),c=document.createElement("div"),n=document.createElement("div"),w=document.createElement("div"),D=document.createElement("div"),E=document.createElement("div"),u=document.createElement("div");q.className=e;m.className= | |
20 | +"introjs-tooltipReferenceLayer";t.call(b,q);t.call(b,m);this._targetElement.appendChild(q);this._targetElement.appendChild(m);c.className="introjs-arrow";w.className="introjs-tooltiptext";w.innerHTML=a.intro;D.className="introjs-bullets";!1===this._options.showBullets&&(D.style.display="none");for(var q=document.createElement("ul"),e=0,B=this._introItems.length;e<B;e++){var A=document.createElement("li"),z=document.createElement("a");z.onclick=function(){b.goToStep(this.getAttribute("data-stepnumber"))}; | |
21 | +e===a.step-1&&(z.className="active");z.href="javascript:void(0);";z.innerHTML=" ";z.setAttribute("data-stepnumber",this._introItems[e].step);A.appendChild(z);q.appendChild(A)}D.appendChild(q);E.className="introjs-progress";!1===this._options.showProgress&&(E.style.display="none");e=document.createElement("div");e.className="introjs-progressbar";e.setAttribute("style","width:"+I.call(this)+"%;");E.appendChild(e);u.className="introjs-tooltipbuttons";!1===this._options.showButtons&&(u.style.display= | |
22 | +"none");n.className="introjs-tooltip";n.appendChild(w);n.appendChild(D);n.appendChild(E);!0==this._options.showStepNumbers&&(g=document.createElement("span"),g.className="introjs-helperNumberLayer",g.innerHTML=a.step,m.appendChild(g));n.appendChild(c);m.appendChild(n);r=document.createElement("a");r.onclick=function(){b._introItems.length-1!=b._currentStep&&x.call(b)};r.href="javascript:void(0);";r.innerHTML=this._options.nextLabel;m=document.createElement("a");m.onclick=function(){0!=b._currentStep&& | |
23 | +C.call(b)};m.href="javascript:void(0);";m.innerHTML=this._options.prevLabel;l=document.createElement("a");l.className="introjs-button introjs-skipbutton";l.href="javascript:void(0);";l.innerHTML=this._options.skipLabel;l.onclick=function(){b._introItems.length-1==b._currentStep&&"function"===typeof b._introCompleteCallback&&b._introCompleteCallback.call(b);b._introItems.length-1!=b._currentStep&&"function"===typeof b._introExitCallback&&b._introExitCallback.call(b);y.call(b,b._targetElement)};u.appendChild(l); | |
24 | +1<this._introItems.length&&(u.appendChild(m),u.appendChild(r));n.appendChild(u);H.call(b,a.element,n,c,g)}!0===this._options.disableInteraction&&L.call(b);m.removeAttribute("tabIndex");r.removeAttribute("tabIndex");0==this._currentStep&&1<this._introItems.length?(m.className="introjs-button introjs-prevbutton introjs-disabled",m.tabIndex="-1",r.className="introjs-button introjs-nextbutton",l.innerHTML=this._options.skipLabel):this._introItems.length-1==this._currentStep||1==this._introItems.length? | |
25 | +(l.innerHTML=this._options.doneLabel,m.className="introjs-button introjs-prevbutton",r.className="introjs-button introjs-nextbutton introjs-disabled",r.tabIndex="-1"):(m.className="introjs-button introjs-prevbutton",r.className="introjs-button introjs-nextbutton",l.innerHTML=this._options.skipLabel);r.focus();a.element.className+=" introjs-showElement";g=v(a.element,"position");"absolute"!==g&&"relative"!==g&&(a.element.className+=" introjs-relativePosition");for(g=a.element.parentNode;null!=g&&"body"!== | |
26 | +g.tagName.toLowerCase();){c=v(g,"z-index");n=parseFloat(v(g,"opacity"));u=v(g,"transform")||v(g,"-webkit-transform")||v(g,"-moz-transform")||v(g,"-ms-transform")||v(g,"-o-transform");if(/[0-9]+/.test(c)||1>n||"none"!==u)g.className+=" introjs-fixParent";g=g.parentNode}M(a.element)||!0!==this._options.scrollToElement||(n=a.element.getBoundingClientRect(),g=F().height,c=n.bottom-(n.bottom-n.top),n=n.bottom-g,0>c||a.element.clientHeight>g?window.scrollBy(0,c-30):window.scrollBy(0,n+100));"undefined"!== | |
27 | +typeof this._introAfterChangeCallback&&this._introAfterChangeCallback.call(this,a.element)}function v(a,b){var c="";a.currentStyle?c=a.currentStyle[b]:document.defaultView&&document.defaultView.getComputedStyle&&(c=document.defaultView.getComputedStyle(a,null).getPropertyValue(b));return c&&c.toLowerCase?c.toLowerCase():c}function F(){if(void 0!=window.innerWidth)return{width:window.innerWidth,height:window.innerHeight};var a=document.documentElement;return{width:a.clientWidth,height:a.clientHeight}} | |
28 | +function M(a){a=a.getBoundingClientRect();return 0<=a.top&&0<=a.left&&a.bottom+80<=window.innerHeight&&a.right<=window.innerWidth}function K(a){var b=document.createElement("div"),c="",d=this;b.className="introjs-overlay";if("body"===a.tagName.toLowerCase())c+="top: 0;bottom: 0; left: 0;right: 0;position: fixed;",b.setAttribute("style",c);else{var e=k(a);e&&(c+="width: "+e.width+"px; height:"+e.height+"px; top:"+e.top+"px;left: "+e.left+"px;",b.setAttribute("style",c))}a.appendChild(b);b.onclick= | |
29 | +function(){!0==d._options.exitOnOverlayClick&&(y.call(d,a),void 0!=d._introExitCallback&&d._introExitCallback.call(d))};setTimeout(function(){c+="opacity: "+d._options.overlayOpacity.toString()+";";b.setAttribute("style",c)},10);return!0}function k(a){var b={};b.width=a.offsetWidth;b.height=a.offsetHeight;for(var c=0,d=0;a&&!isNaN(a.offsetLeft)&&!isNaN(a.offsetTop);)c+=a.offsetLeft,d+=a.offsetTop,a=a.offsetParent;b.top=d;b.left=c;return b}function I(){return 100*(parseInt(this._currentStep+1,10)/ | |
30 | +this._introItems.length)}var B=function(a){if("object"===typeof a)return new p(a);if("string"===typeof a){if(a=document.querySelector(a))return new p(a);throw Error("There is no element with given selector.");}return new p(document.body)};B.version="1.0.0";B.fn=p.prototype={clone:function(){return new p(this)},setOption:function(a,b){this._options[a]=b;return this},setOptions:function(a){var b=this._options,c={},d;for(d in b)c[d]=b[d];for(d in a)c[d]=a[d];this._options=c;return this},start:function(){J.call(this, | |
31 | +this._targetElement);return this},goToStep:function(a){this._currentStep=a-2;"undefined"!==typeof this._introItems&&x.call(this);return this},nextStep:function(){x.call(this);return this},previousStep:function(){C.call(this);return this},exit:function(){y.call(this,this._targetElement);return this},refresh:function(){t.call(this,document.querySelector(".introjs-helperLayer"));t.call(this,document.querySelector(".introjs-tooltipReferenceLayer"));return this},onbeforechange:function(a){if("function"=== | |
32 | +typeof a)this._introBeforeChangeCallback=a;else throw Error("Provided callback for onbeforechange was not a function");return this},onchange:function(a){if("function"===typeof a)this._introChangeCallback=a;else throw Error("Provided callback for onchange was not a function.");return this},onafterchange:function(a){if("function"===typeof a)this._introAfterChangeCallback=a;else throw Error("Provided callback for onafterchange was not a function");return this},oncomplete:function(a){if("function"=== | |
33 | +typeof a)this._introCompleteCallback=a;else throw Error("Provided callback for oncomplete was not a function.");return this},onexit:function(a){if("function"===typeof a)this._introExitCallback=a;else throw Error("Provided callback for onexit was not a function.");return this}};return w.introJs=B}); | ... | ... |
... | ... | @@ -0,0 +1 @@ |
1 | +.introjs-overlay{position:absolute;z-index:999999;background-color:#000;opacity:0;background:-moz-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%);background:-webkit-gradient(radial,center center,0px,center center,100%,color-stop(0%,rgba(0,0,0,0.4)),color-stop(100%,rgba(0,0,0,0.9)));background:-webkit-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%);background:-o-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%);background:-ms-radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%);background:radial-gradient(center,ellipse cover,rgba(0,0,0,0.4) 0,rgba(0,0,0,0.9) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#66000000',endColorstr='#e6000000',GradientType=1);-ms-filter:"alpha(opacity=50)";filter:alpha(opacity=50);-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-ms-transition:all .3s ease-out;-o-transition:all .3s ease-out;transition:all .3s ease-out}.introjs-fixParent{z-index:auto!important;opacity:1.0!important;position:absolute!important;-webkit-transform:none!important;-moz-transform:none!important;-ms-transform:none!important;-o-transform:none!important;transform:none!important}.introjs-showElement,tr.introjs-showElement>td,tr.introjs-showElement>th{z-index:9999999!important}.introjs-disableInteraction{z-index:99999999!important;position:absolute}.introjs-relativePosition,tr.introjs-showElement>td,tr.introjs-showElement>th{position:relative}.introjs-helperLayer{position:absolute;z-index:9999998;background-color:#FFF;background-color:rgba(255,255,255,.9);border:1px solid #777;border:1px solid rgba(0,0,0,.5);border-radius:4px;box-shadow:0 2px 15px rgba(0,0,0,.4);-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-ms-transition:all .3s ease-out;-o-transition:all .3s ease-out;transition:all .3s ease-out}.introjs-tooltipReferenceLayer{position:absolute;z-index:10000000;background-color:transparent;-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-ms-transition:all .3s ease-out;-o-transition:all .3s ease-out;transition:all .3s ease-out}.introjs-helperLayer *,.introjs-helperLayer *:before,.introjs-helperLayer *:after{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;-ms-box-sizing:content-box;-o-box-sizing:content-box;box-sizing:content-box}.introjs-helperNumberLayer{position:absolute;top:-16px;left:-16px;z-index:9999999999!important;padding:2px;font-family:Arial,verdana,tahoma;font-size:13px;font-weight:bold;color:white;text-align:center;text-shadow:1px 1px 1px rgba(0,0,0,.3);background:#ff3019;background:-webkit-linear-gradient(top,#ff3019 0,#cf0404 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#ff3019),color-stop(100%,#cf0404));background:-moz-linear-gradient(top,#ff3019 0,#cf0404 100%);background:-ms-linear-gradient(top,#ff3019 0,#cf0404 100%);background:-o-linear-gradient(top,#ff3019 0,#cf0404 100%);background:linear-gradient(to bottom,#ff3019 0,#cf0404 100%);width:20px;height:20px;line-height:20px;border:3px solid white;border-radius:50%;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3019',endColorstr='#cf0404',GradientType=0);filter:progid:DXImageTransform.Microsoft.Shadow(direction=135,strength=2,color=ff0000);box-shadow:0 2px 5px rgba(0,0,0,.4)}.introjs-arrow{border:5px solid white;content:'';position:absolute}.introjs-arrow.top{top:-10px;border-top-color:transparent;border-right-color:transparent;border-bottom-color:white;border-left-color:transparent}.introjs-arrow.top-right{top:-10px;right:10px;border-top-color:transparent;border-right-color:transparent;border-bottom-color:white;border-left-color:transparent}.introjs-arrow.top-middle{top:-10px;left:50%;margin-left:-5px;border-top-color:transparent;border-right-color:transparent;border-bottom-color:white;border-left-color:transparent}.introjs-arrow.right{right:-10px;top:10px;border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:white}.introjs-arrow.right-bottom{bottom:10px;right:-10px;border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:white}.introjs-arrow.bottom{bottom:-10px;border-top-color:white;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent}.introjs-arrow.left{left:-10px;top:10px;border-top-color:transparent;border-right-color:white;border-bottom-color:transparent;border-left-color:transparent}.introjs-arrow.left-bottom{left:-10px;bottom:10px;border-top-color:transparent;border-right-color:white;border-bottom-color:transparent;border-left-color:transparent}.introjs-tooltip{position:absolute;padding:10px;background-color:white;min-width:200px;max-width:300px;border-radius:3px;box-shadow:0 1px 10px rgba(0,0,0,.4);-webkit-transition:opacity .1s ease-out;-moz-transition:opacity .1s ease-out;-ms-transition:opacity .1s ease-out;-o-transition:opacity .1s ease-out;transition:opacity .1s ease-out}.introjs-tooltipbuttons{text-align:right;white-space:nowrap}.introjs-button{position:relative;overflow:visible;display:inline-block;padding:.3em .8em;border:1px solid #d4d4d4;margin:0;text-decoration:none;text-shadow:1px 1px 0 #fff;font:11px/normal sans-serif;color:#333;white-space:nowrap;cursor:pointer;outline:0;background-color:#ececec;background-image:-webkit-gradient(linear,0 0,0 100%,from(#f4f4f4),to(#ececec));background-image:-moz-linear-gradient(#f4f4f4,#ececec);background-image:-o-linear-gradient(#f4f4f4,#ececec);background-image:linear-gradient(#f4f4f4,#ececec);-webkit-background-clip:padding;-moz-background-clip:padding;-o-background-clip:padding-box;-webkit-border-radius:.2em;-moz-border-radius:.2em;border-radius:.2em;zoom:1;*display:inline;margin-top:10px}.introjs-button:hover{border-color:#bcbcbc;text-decoration:none;box-shadow:0 1px 1px #e3e3e3}.introjs-button:focus,.introjs-button:active{background-image:-webkit-gradient(linear,0 0,0 100%,from(#ececec),to(#f4f4f4));background-image:-moz-linear-gradient(#ececec,#f4f4f4);background-image:-o-linear-gradient(#ececec,#f4f4f4);background-image:linear-gradient(#ececec,#f4f4f4)}.introjs-button::-moz-focus-inner{padding:0;border:0}.introjs-skipbutton{margin-right:5px;color:#7a7a7a}.introjs-prevbutton{-webkit-border-radius:.2em 0 0 .2em;-moz-border-radius:.2em 0 0 .2em;border-radius:.2em 0 0 .2em;border-right:0}.introjs-nextbutton{-webkit-border-radius:0 .2em .2em 0;-moz-border-radius:0 .2em .2em 0;border-radius:0 .2em .2em 0}.introjs-disabled,.introjs-disabled:hover,.introjs-disabled:focus{color:#9a9a9a;border-color:#d4d4d4;box-shadow:none;cursor:default;background-color:#f4f4f4;background-image:none;text-decoration:none}.introjs-bullets{text-align:center}.introjs-bullets ul{clear:both;margin:15px auto 0;padding:0;display:inline-block}.introjs-bullets ul li{list-style:none;float:left;margin:0 2px}.introjs-bullets ul li a{display:block;width:6px;height:6px;background:#ccc;border-radius:10px;-moz-border-radius:10px;-webkit-border-radius:10px;text-decoration:none}.introjs-bullets ul li a:hover{background:#999}.introjs-bullets ul li a.active{background:#999}.introjs-progress{overflow:hidden;height:10px;margin:10px 0 5px 0;border-radius:4px;background-color:#ecf0f1}.introjs-progressbar{float:left;width:0;height:100%;font-size:10px;line-height:10px;text-align:center;background-color:#08c}.introjsFloatingElement{position:absolute;height:0;width:0;left:50%;top:50%} | |
0 | 2 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,99 @@ |
1 | +var siteTourPlugin = (function() { | |
2 | + | |
3 | + var actions = []; | |
4 | + var groupTriggers = []; | |
5 | + var userData = {}; | |
6 | + var intro; | |
7 | + var options = {}; | |
8 | + | |
9 | + function hasMark(name) { | |
10 | + return jQuery.cookie("_noosfero_.sitetour." + name) || | |
11 | + jQuery.inArray(name, userData.site_tour_plugin_actions)>=0; | |
12 | + } | |
13 | + | |
14 | + function mark(name) { | |
15 | + jQuery.cookie("_noosfero_.sitetour." + name, 1, {expires: 365}); | |
16 | + if(userData.login) { | |
17 | + jQuery.post('/plugin/site_tour/public/mark_action', {action_name: name}, function(data) { }); | |
18 | + } | |
19 | + } | |
20 | + | |
21 | + function clearAll() { | |
22 | + jQuery('.site-tour-plugin').removeAttr('data-intro data-intro-name data-step'); | |
23 | + } | |
24 | + | |
25 | + function configureIntro(force, actions) { | |
26 | + clearAll(); | |
27 | + for(var i=0; i<actions.length; i++) { | |
28 | + var action = actions[i]; | |
29 | + | |
30 | + if(force || !hasMark(action.name)) { | |
31 | + var el = jQuery(action.selector).filter(function() { | |
32 | + return jQuery(this).is(":visible") && jQuery(this).css('visibility') != 'hidden'; | |
33 | + }); | |
34 | + el.addClass('site-tour-plugin'); | |
35 | + el.attr('data-intro', action.text); | |
36 | + el.attr('data-intro-name', action.name); | |
37 | + if(action.step) { | |
38 | + el.attr('data-step', action.step); | |
39 | + } | |
40 | + } | |
41 | + } | |
42 | + } | |
43 | + | |
44 | + function actionsOnload() { | |
45 | + var groups = jQuery.map(groupTriggers, function(g) { return g.name; }); | |
46 | + return jQuery.grep(actions, function(n, i) { return jQuery.inArray(n.name, groups); }); | |
47 | + } | |
48 | + | |
49 | + function actionsByGroup(group) { | |
50 | + return jQuery.grep(actions, function(n, i) { return n.name===group }); | |
51 | + } | |
52 | + | |
53 | + function forceParam() { | |
54 | + return jQuery.deparam.querystring()['siteTourPlugin']==='force'; | |
55 | + } | |
56 | + | |
57 | + return { | |
58 | + setOption: function(key, value) { | |
59 | + options[key] = value; | |
60 | + }, | |
61 | + add: function (name, selector, text, step) { | |
62 | + actions.push({name: name, selector: selector, text: text, step: step}); | |
63 | + }, | |
64 | + addGroupTrigger: function(name, selector, ev) { | |
65 | + groupTriggers.push({name: name, selector: selector, event: ev}); | |
66 | + plugin = this; | |
67 | + var handler = function() { | |
68 | + configureIntro(forceParam(), actionsByGroup(name)); | |
69 | + intro.start(); | |
70 | + jQuery(document).off(ev, selector, handler); | |
71 | + }; | |
72 | + jQuery(document).on(ev, selector, handler); | |
73 | + }, | |
74 | + start: function(data, force) { | |
75 | + force = typeof force !== 'undefined' ? force : false || forceParam(); | |
76 | + userData = data; | |
77 | + | |
78 | + intro = introJs(); | |
79 | + intro.setOption('tooltipPosition', 'auto'); | |
80 | + intro.setOption('showStepNumbers', 'false'); | |
81 | + intro.setOptions(options); | |
82 | + intro.onafterchange(function(targetElement) { | |
83 | + var name = jQuery(targetElement).attr('data-intro-name'); | |
84 | + mark(name); | |
85 | + }); | |
86 | + configureIntro(force, actionsOnload()); | |
87 | + intro.start(); | |
88 | + }, | |
89 | + force: function() { | |
90 | + this.start({}, true); | |
91 | + } | |
92 | + } | |
93 | +})(); | |
94 | + | |
95 | +jQuery( document ).ready(function( $ ) { | |
96 | + $(window).bind('userDataLoaded', function(event, data) { | |
97 | + siteTourPlugin.start(data); | |
98 | + }); | |
99 | +}); | ... | ... |
... | ... | @@ -0,0 +1,6 @@ |
1 | +jQuery( document ).ready(function( $ ) { | |
2 | + siteTourPlugin.add('login_button','.action-home-index #link_login', "Click to login!"); | |
3 | + siteTourPlugin.add('login_button','.action-home-index .signup', "Click to signup!"); | |
4 | + siteTourPlugin.add('logout_button','.action-home-index #logout', "Click to logout"); | |
5 | + siteTourPlugin.add('navigation_bar','#navigation', "Click to navigate"); | |
6 | +}); | ... | ... |
plugins/site_tour/test/functional/site_tour_plugin_admin_controller_test.rb
0 → 100644
... | ... | @@ -0,0 +1,58 @@ |
1 | +require File.dirname(__FILE__) + '/../test_helper' | |
2 | + | |
3 | +class SiteTourPluginAdminControllerTest < ActionController::TestCase | |
4 | + | |
5 | + def setup | |
6 | + @environment = Environment.default | |
7 | + login_as(create_admin_user(@environment)) | |
8 | + end | |
9 | + | |
10 | + attr_reader :environment | |
11 | + | |
12 | + should 'parse csv and save actions array in plugin settings' do | |
13 | + actions_csv = "en,tour_plugin,.tour-button,Click" | |
14 | + post :index, :settings => {"actions_csv" => actions_csv} | |
15 | + @settings = Noosfero::Plugin::Settings.new(environment.reload, SiteTourPlugin) | |
16 | + assert_equal [{:language => 'en', :group_name => 'tour_plugin', :selector => '.tour-button', :description => 'Click'}], @settings.actions | |
17 | + end | |
18 | + | |
19 | + should 'parse csv and save group triggers array in plugin settings' do | |
20 | + group_triggers_csv = "tour_plugin,.tour-button,mouseenter" | |
21 | + post :index, :settings => {"group_triggers_csv" => group_triggers_csv} | |
22 | + @settings = Noosfero::Plugin::Settings.new(environment.reload, SiteTourPlugin) | |
23 | + assert_equal [{:group_name => 'tour_plugin', :selector => '.tour-button', :event => 'mouseenter'}], @settings.group_triggers | |
24 | + end | |
25 | + | |
26 | + should 'do not store actions_csv' do | |
27 | + actions_csv = "en,tour_plugin,.tour-button,Click" | |
28 | + post :index, :settings => {"actions_csv" => actions_csv} | |
29 | + @settings = Noosfero::Plugin::Settings.new(environment.reload, SiteTourPlugin) | |
30 | + assert_equal nil, @settings.settings[:actions_csv] | |
31 | + end | |
32 | + | |
33 | + should 'do not store group_triggers_csv' do | |
34 | + group_triggers_csv = "tour_plugin,.tour-button,click" | |
35 | + post :index, :settings => {"group_triggers_csv" => group_triggers_csv} | |
36 | + @settings = Noosfero::Plugin::Settings.new(environment.reload, SiteTourPlugin) | |
37 | + assert_equal nil, @settings.settings[:group_triggers_csv] | |
38 | + end | |
39 | + | |
40 | + should 'convert actions array to csv to enable user edition' do | |
41 | + @settings = Noosfero::Plugin::Settings.new(environment.reload, SiteTourPlugin) | |
42 | + @settings.actions = [{:language => 'en', :group_name => 'tour_plugin', :selector => '.tour-button', :description => 'Click'}] | |
43 | + @settings.save! | |
44 | + | |
45 | + get :index | |
46 | + assert_tag :tag => 'textarea', :attributes => {:class => 'actions-csv'}, :content => "\nen,tour_plugin,.tour-button,Click\n" | |
47 | + end | |
48 | + | |
49 | + should 'convert group_triggers array to csv to enable user edition' do | |
50 | + @settings = Noosfero::Plugin::Settings.new(environment.reload, SiteTourPlugin) | |
51 | + @settings.group_triggers = [{:group_name => 'tour_plugin', :selector => '.tour-button', :event => 'click'}] | |
52 | + @settings.save! | |
53 | + | |
54 | + get :index | |
55 | + assert_tag :tag => 'textarea', :attributes => {:class => 'groups-csv'}, :content => "\ntour_plugin,.tour-button,click\n" | |
56 | + end | |
57 | + | |
58 | +end | ... | ... |
plugins/site_tour/test/functional/site_tour_plugin_public_controller_test.rb
0 → 100644
... | ... | @@ -0,0 +1,30 @@ |
1 | +require File.dirname(__FILE__) + '/../test_helper' | |
2 | + | |
3 | +class SiteTourPluginPublicControllerTest < ActionController::TestCase | |
4 | + | |
5 | + def setup | |
6 | + @person = create_user('testuser').person | |
7 | + end | |
8 | + | |
9 | + attr_accessor :person | |
10 | + | |
11 | + should 'not be able to mark an action if is not logged in' do | |
12 | + xhr :post, :mark_action, :action_name => 'test' | |
13 | + assert_response 401 | |
14 | + end | |
15 | + | |
16 | + should 'be able to mark one action' do | |
17 | + login_as(person.identifier) | |
18 | + xhr :post, :mark_action, :action_name => 'test' | |
19 | + assert_equal({'ok' => true}, ActiveSupport::JSON.decode(response.body)) | |
20 | + assert_equal ['test'], person.reload.site_tour_plugin_actions | |
21 | + end | |
22 | + | |
23 | + should 'be able to mark multiple actions' do | |
24 | + login_as(person.identifier) | |
25 | + xhr :post, :mark_action, :action_name => ['test1', 'test2'] | |
26 | + assert_equal({'ok' => true}, ActiveSupport::JSON.decode(response.body)) | |
27 | + assert_equal ['test1', 'test2'], person.reload.site_tour_plugin_actions | |
28 | + end | |
29 | + | |
30 | +end | ... | ... |
... | ... | @@ -0,0 +1 @@ |
1 | +require File.dirname(__FILE__) + '/../../../test/test_helper' | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +require File.dirname(__FILE__) + '/../test_helper' | |
2 | + | |
3 | +class SiteTourHelperTest < ActionView::TestCase | |
4 | + | |
5 | + include SiteTourPlugin::SiteTourHelper | |
6 | + | |
7 | + should 'parse tooltip description' do | |
8 | + assert_equal 'test', parse_tour_description("test") | |
9 | + end | |
10 | + | |
11 | + should 'replace profile attributes in tooltip description' do | |
12 | + profile = fast_create(Profile) | |
13 | + expects(:profile).returns(profile).at_least_once | |
14 | + assert_equal "name #{profile.name}, identifier #{profile.identifier}, url #{url_for profile.url}", parse_tour_description("name {profile.name}, identifier {profile.identifier}, url {profile.url}") | |
15 | + end | |
16 | + | |
17 | +end | ... | ... |
... | ... | @@ -0,0 +1,73 @@ |
1 | +require File.dirname(__FILE__) + '/../test_helper' | |
2 | + | |
3 | +class SiteTourPluginTest < ActionView::TestCase | |
4 | + | |
5 | + def setup | |
6 | + @plugin = SiteTourPlugin.new | |
7 | + end | |
8 | + | |
9 | + attr_accessor :plugin | |
10 | + | |
11 | + should 'include site tour plugin actions in user data for logged in users' do | |
12 | + expects(:logged_in?).returns(true) | |
13 | + person = create_user('testuser').person | |
14 | + person.site_tour_plugin_actions = ['login', 'navigation'] | |
15 | + expects(:user).returns(person) | |
16 | + | |
17 | + assert_equal({:site_tour_plugin_actions => ['login', 'navigation']}, instance_eval(&plugin.user_data_extras)) | |
18 | + end | |
19 | + | |
20 | + should 'return empty hash when user is not logged in' do | |
21 | + expects(:logged_in?).returns(false) | |
22 | + assert_equal({}, instance_eval(&plugin.user_data_extras)) | |
23 | + end | |
24 | + | |
25 | + should 'include javascript related to tour instructions if file exists' do | |
26 | + file = '/plugins/site_tour/tour/pt/tour.js' | |
27 | + expects(:language).returns('pt') | |
28 | + File.expects(:exists?).with(Rails.root.join("public#{file}").to_s).returns(true) | |
29 | + expects(:environment).returns(Environment.default) | |
30 | + assert_tag_in_string instance_exec(&plugin.body_ending), :tag => 'script' | |
31 | + end | |
32 | + | |
33 | + should 'not include javascript file that not exists' do | |
34 | + file = '/plugins/site_tour/tour/pt/tour.js' | |
35 | + expects(:language).returns('pt') | |
36 | + File.expects(:exists?).with(Rails.root.join("public#{file}").to_s).returns(false) | |
37 | + expects(:environment).returns(Environment.default) | |
38 | + assert_no_tag_in_string instance_exec(&plugin.body_ending), :tag => "script" | |
39 | + end | |
40 | + | |
41 | + should 'render javascript tag with tooltip actions and group triggers' do | |
42 | + expects(:language).returns('en').at_least_once | |
43 | + | |
44 | + settings = Noosfero::Plugin::Settings.new(Environment.default, SiteTourPlugin) | |
45 | + settings.actions = [{:language => 'en', :group_name => 'test', :selector => 'body', :description => 'Test'}] | |
46 | + settings.group_triggers = [{:group_name => 'test', :selector => 'body', :event => 'click'}] | |
47 | + settings.save! | |
48 | + | |
49 | + expects(:environment).returns(Environment.default) | |
50 | + body_ending = instance_exec(&plugin.body_ending) | |
51 | + assert_match /siteTourPlugin\.add\('test', 'body', 'Test', 1\);/, body_ending | |
52 | + assert_match /siteTourPlugin\.addGroupTrigger\('test', 'body', 'click'\);/, body_ending | |
53 | + end | |
54 | + | |
55 | + should 'start each tooltip group with the correct step order' do | |
56 | + expects(:language).returns('en').at_least_once | |
57 | + | |
58 | + settings = Noosfero::Plugin::Settings.new(Environment.default, SiteTourPlugin) | |
59 | + settings.actions = [ | |
60 | + {:language => 'en', :group_name => 'test_a', :selector => 'body', :description => 'Test A1'}, | |
61 | + {:language => 'en', :group_name => 'test_a', :selector => 'body', :description => 'Test A2'}, | |
62 | + {:language => 'en', :group_name => 'test_b', :selector => 'body', :description => 'Test B1'}, | |
63 | + ] | |
64 | + settings.save! | |
65 | + | |
66 | + expects(:environment).returns(Environment.default) | |
67 | + body_ending = instance_exec(&plugin.body_ending) | |
68 | + assert_match /siteTourPlugin\.add\('test_a', 'body', 'Test A1', 1\);/, body_ending | |
69 | + assert_match /siteTourPlugin\.add\('test_a', 'body', 'Test A2', 2\);/, body_ending | |
70 | + assert_match /siteTourPlugin\.add\('test_b', 'body', 'Test B1', 3\);/, body_ending | |
71 | + end | |
72 | + | |
73 | +end | ... | ... |
... | ... | @@ -0,0 +1,41 @@ |
1 | +require File.dirname(__FILE__) + '/../test_helper' | |
2 | + | |
3 | +class TrackListBlockTest < ActionView::TestCase | |
4 | + | |
5 | + ActionView::Base.send :include, ApplicationHelper | |
6 | + | |
7 | + def setup | |
8 | + @block = fast_create(SiteTourPlugin::TourBlock) | |
9 | + end | |
10 | + | |
11 | + attr_accessor :block | |
12 | + | |
13 | + should 'do not save empty actions' do | |
14 | + block.actions = [{:group_name => '', :selector => nil, :description => ' '}] | |
15 | + block.save! | |
16 | + assert_equal [], block.actions | |
17 | + end | |
18 | + | |
19 | + should 'render script tag in visualization mode' do | |
20 | + controller.expects(:boxes_editor?).returns(false) | |
21 | + assert_tag_in_string instance_eval(&block.content), :tag => 'script' | |
22 | + end | |
23 | + | |
24 | + should 'do not render script tag when editing' do | |
25 | + controller.expects(:boxes_editor?).returns(true) | |
26 | + controller.expects(:uses_design_blocks?).returns(true) | |
27 | + assert_no_tag_in_string instance_eval(&block.content), :tag => 'script' | |
28 | + end | |
29 | + | |
30 | + should 'display help button' do | |
31 | + controller.expects(:boxes_editor?).returns(false) | |
32 | + assert_tag_in_string instance_eval(&block.content), :tag => 'a', :attributes => {:class => 'button icon-help with-text tour-button'} | |
33 | + end | |
34 | + | |
35 | + should 'do not display help button when display_button is false' do | |
36 | + block.display_button = false | |
37 | + controller.expects(:boxes_editor?).returns(false) | |
38 | + assert_no_tag_in_string instance_eval(&block.content), :tag => 'a', :attributes => {:class => 'button icon-help with-text tour-button'} | |
39 | + end | |
40 | + | |
41 | +end | ... | ... |
... | ... | @@ -0,0 +1,11 @@ |
1 | +<%= block_title(block.title) %> | |
2 | + | |
3 | +<% if block.display_button %> | |
4 | + <%= button :help, _('Help'), '#', :class => 'tour-button', :onclick => 'siteTourPlugin.force();' %> | |
5 | +<% end %> | |
6 | + | |
7 | +<% edit_mode = controller.send(:boxes_editor?) && controller.send(:uses_design_blocks?) %> | |
8 | + | |
9 | +<% unless edit_mode %> | |
10 | + <%= render :file => 'tour_actions', :locals => {:actions => block.actions, :group_triggers => block.group_triggers} %> | |
11 | +<% end %> | ... | ... |
plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block.html.erb
0 → 100644
... | ... | @@ -0,0 +1,44 @@ |
1 | +<%= javascript_include_tag '/plugins/site_tour/edit_tour_block.js' %> | |
2 | +<%= stylesheet_link_tag '/plugins/site_tour/edit_tour_block.css' %> | |
3 | + | |
4 | +<%= labelled_form_field check_box(:block, :display_button) + _('Display help button'), '' %> | |
5 | + | |
6 | +<div id='edit-tour-block'> | |
7 | + <div id="tooltip-actions" class="list-items"> | |
8 | + <h3><%= _('Tooltip Actions') %></h3> | |
9 | + <div class="special-attributes"><%= _('Special fields for description: {profile.name}, {profile.identifier}, {profile.url}.') %></div> | |
10 | + <ul class='list-header'> | |
11 | + <li class='list-name'><%= _('Group Name') %></li> | |
12 | + <li class='list-selector'><%= _('Selector') %></li> | |
13 | + <li class='list-description'><%= _('Description') %></li> | |
14 | + </ul> | |
15 | + <ul id="droppable-tour-actions" class="droppable-items"> | |
16 | + <% for action in @block.actions do %> | |
17 | + <%= render :partial => 'box_organizer/site_tour_plugin/tour_block_item', :locals => {:action => action} %> | |
18 | + <% end %> | |
19 | + </ul> | |
20 | + <div id="new-template"> | |
21 | + <%= render :partial => 'box_organizer/site_tour_plugin/tour_block_item', :locals => {:action => {} } %> | |
22 | + </div> | |
23 | + <%= link_to_function(_('New Tooltip'), :class => 'add-item button icon-add with-text') %> | |
24 | + </div> | |
25 | + | |
26 | + <div id="group-triggers" class="list-items"> | |
27 | + <h3><%= _('Group Triggers') %></h3> | |
28 | + <ul class='list-header'> | |
29 | + <li class='list-name'><%= _('Group Name') %></li> | |
30 | + <li class='list-selector'><%= _('Selector') %></li> | |
31 | + <li class='list-event'><%= _('Event') %></li> | |
32 | + </ul> | |
33 | + <ul id="droppable-tour-group-triggers" class="droppable-items"> | |
34 | + <% for group in @block.group_triggers do %> | |
35 | + <%= render :partial => 'box_organizer/site_tour_plugin/tour_block_group_item', :locals => {:group => group} %> | |
36 | + <% end %> | |
37 | + </ul> | |
38 | + <div id="new-template"> | |
39 | + <%= render :partial => 'box_organizer/site_tour_plugin/tour_block_group_item', :locals => {:group => {} } %> | |
40 | + </div> | |
41 | + <%= link_to_function(_('New Group Trigger'), :class => 'add-item button icon-add with-text') %> | |
42 | + </div> | |
43 | + | |
44 | +</div> | ... | ... |
plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block_group_item.html.erb
0 → 100644
... | ... | @@ -0,0 +1,19 @@ |
1 | +<li> | |
2 | + <ul class="item-row"> | |
3 | + <li> | |
4 | + <%= text_field_tag 'block[group_triggers][][group_name]', group[:group_name], :class => 'group-name', :maxlength => 20 %> | |
5 | + </li> | |
6 | + <li> | |
7 | + <%= text_field_tag 'block[group_triggers][][selector]', group[:selector], :class => 'selector' %> | |
8 | + </li> | |
9 | + <li> | |
10 | + <%= select_tag 'block[group_triggers][][event]', | |
11 | + options_for_select(['mouseenter', 'mouseleave', 'mouseover', 'mouseout', 'click', 'change', 'select', 'keydown', 'keyup', 'keypress', 'focus', 'blur', 'submit', 'drag', 'drop'], group[:event]), | |
12 | + :class => 'description' %> | |
13 | + </li> | |
14 | + <li> | |
15 | + <%= button_without_text(:delete, _('Delete'), "#" , :class=>"delete-tour-block-item") %> | |
16 | + </li> | |
17 | + </ul> | |
18 | +</li> | |
19 | + | ... | ... |
plugins/site_tour/views/box_organizer/site_tour_plugin/_tour_block_item.html.erb
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +<li> | |
2 | + <ul class="item-row"> | |
3 | + <li> | |
4 | + <%= text_field_tag 'block[actions][][group_name]', action[:group_name], :class => 'group-name', :maxlength => 20 %> | |
5 | + </li> | |
6 | + <li> | |
7 | + <%= text_field_tag 'block[actions][][selector]', action[:selector], :class => 'selector' %> | |
8 | + </li> | |
9 | + <li> | |
10 | + <%= text_field_tag 'block[actions][][description]', action[:description], :class => 'description' %> | |
11 | + </li> | |
12 | + <li> | |
13 | + <%= button_without_text(:delete, _('Delete'), "#" , :class=>"delete-tour-block-item") %> | |
14 | + </li> | |
15 | + </ul> | |
16 | +</li> | ... | ... |
plugins/site_tour/views/environment_design/site_tour_plugin
0 → 120000
plugins/site_tour/views/site_tour_plugin_admin/index.html.erb
0 → 100644
... | ... | @@ -0,0 +1,13 @@ |
1 | +<h1><%= _('Site Tour Settings')%></h1> | |
2 | + | |
3 | +<%= form_for(:settings) do |f| %> | |
4 | + | |
5 | + <%= labelled_form_field _('Tooltips (CSV format: language, group name, selector, description)'), f.text_area(:actions_csv, :style => 'width: 100%', :class => 'actions-csv') %> | |
6 | + <%= labelled_form_field _('Group Triggers (CSV format: group name, selector, event (e.g. mouseenter, click))'), f.text_area(:group_triggers_csv, :style => 'width: 100%', :class => 'groups-csv', :rows => 7) %> | |
7 | + | |
8 | + <% button_bar do %> | |
9 | + <%= submit_button(:save, _('Save'), :cancel => {:controller => 'plugins', :action => 'index'}) %> | |
10 | + <% end %> | |
11 | + | |
12 | +<% end %> | |
13 | + | ... | ... |
... | ... | @@ -0,0 +1,22 @@ |
1 | +<% extend SiteTourPlugin::SiteTourHelper %> | |
2 | +<% js_file = defined?(:js_file) ? js_file : nil %> | |
3 | +<%= javascript_include_tag(js_file) if js_file.present? %> | |
4 | + | |
5 | +<% if actions.present? %> | |
6 | +<script> | |
7 | + jQuery( document ).ready(function( $ ) { | |
8 | + <% actions.each_with_index do |action, index| %> | |
9 | + <%= "siteTourPlugin.add('#{j action[:group_name]}', '#{j action[:selector]}', '#{j parse_tour_description(action[:description])}', #{index + 1});" %> | |
10 | + <% end %> | |
11 | + | |
12 | + <% (group_triggers||[]).each do |group| %> | |
13 | + <%= "siteTourPlugin.addGroupTrigger('#{j group[:group_name]}', '#{j group[:selector]}', '#{j group[:event]}');" %> | |
14 | + <% end %> | |
15 | + | |
16 | + siteTourPlugin.setOption('nextLabel', '<%= _('Next') %>'); | |
17 | + siteTourPlugin.setOption('prevLabel', '<%= _('Back') %>'); | |
18 | + siteTourPlugin.setOption('skipLabel', '<%= _('Skip') %>'); | |
19 | + siteTourPlugin.setOption('doneLabel', '<%= _('Finish') %>'); | |
20 | + }); | |
21 | +</script> | |
22 | +<% end %> | ... | ... |