tenon 1.0.5 → 1.0.6
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/tenon/features/item_version_autosave.js.coffee +1 -2
- data/app/assets/stylesheets/tenon/colors-custom.css.scss +1 -1
- data/app/assets/stylesheets/tenon/layout/util-nav.css.scss +0 -3
- data/app/assets/stylesheets/tenon/ui/header-tools.css.scss +14 -0
- data/app/controllers/tenon/resources_controller.rb +2 -5
- data/app/views/tenon/events/_form.html.haml +5 -3
- data/app/views/tenon/galleries/_form.html.haml +6 -3
- data/app/views/tenon/pages/_form.html.haml +12 -9
- data/app/views/tenon/posts/_form.html.haml +6 -3
- data/app/views/tenon/settings/_contact.html.haml +19 -0
- data/app/views/tenon/settings/_general.html.haml +12 -40
- data/app/views/tenon/settings/_seo.html.haml +10 -0
- data/app/views/tenon/settings/show.html.haml +13 -2
- data/app/views/tenon/shared/_posts_nav.html.haml +5 -2
- data/lib/generators/tenon/scaffold/templates/view__form.html.haml +11 -10
- data/lib/tenon/i18n_lookup.rb +4 -2
- data/lib/tenon/version.rb +1 -1
- data/spec/features/settings_spec.rb +22 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d34a3218e16002fa3558faafa070b8771aed3d3c
|
4
|
+
data.tar.gz: d778a556210f9411ba8d2144ebc9a7c652cf5e17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63a37b5e5bf36ab1d51ad3f6663fe01e76ff65b56d862006a71794f230f52ed5568f044316c67d843fa012725f1417b9367a4d863caac4151d5b90d1263c60c6
|
7
|
+
data.tar.gz: 5df5c24f57a4d5defeec5fb1db7bba8648aefd891b99d52dc6cf9625ddbeb8e8690b118c6ce8bfe70023051356f361d4e8946126210fb33848b8aab9275105aa
|
@@ -1,10 +1,9 @@
|
|
1
1
|
class Tenon.features.ItemVersionAutosave
|
2
2
|
constructor: ->
|
3
3
|
@$form = $('form[data-autosave="true"]')
|
4
|
-
@$form.on('keyup change cocoon:after-insert cocoon:after-remove', $.debounce(
|
4
|
+
@$form.on('keyup change cocoon:after-insert cocoon:after-remove', $.debounce(3000, @autosave))
|
5
5
|
|
6
6
|
autosave: =>
|
7
|
-
console.log('saved')
|
8
7
|
jqxhr = $.ajax
|
9
8
|
url: @$form.data('version-create-path')
|
10
9
|
data: @_formData()
|
@@ -92,6 +92,20 @@ util-nav {
|
|
92
92
|
.header-menu ul {
|
93
93
|
border-top: 0;
|
94
94
|
}
|
95
|
+
|
96
|
+
.tools {
|
97
|
+
.header-menu.active, .header-menu > a:hover, .header-button > a:hover, .header-button.active {
|
98
|
+
background-color: transparent;
|
99
|
+
}
|
100
|
+
|
101
|
+
.header-menu > a:hover {
|
102
|
+
text-decoration: underline;
|
103
|
+
}
|
104
|
+
|
105
|
+
.header-menu ul {
|
106
|
+
border-top: 0;
|
107
|
+
}
|
108
|
+
}
|
95
109
|
}
|
96
110
|
|
97
111
|
header {
|
@@ -37,6 +37,7 @@ module Tenon
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def update
|
40
|
+
authorize!(:publish, resource)
|
40
41
|
if resource.update_attributes(resource_params)
|
41
42
|
save_item_version if resource.respond_to?(:versions)
|
42
43
|
flash[:notice] = "#{human_name} saved successfully." unless request.xhr?
|
@@ -48,6 +49,7 @@ module Tenon
|
|
48
49
|
|
49
50
|
def create
|
50
51
|
self.resource = klass.new(resource_params).decorate
|
52
|
+
authorize!(:publish, resource)
|
51
53
|
if resource.save && !request.xhr?
|
52
54
|
flash[:notice] = "#{human_name} saved successfully."
|
53
55
|
save_item_version if resource.respond_to?(:versions)
|
@@ -134,11 +136,6 @@ module Tenon
|
|
134
136
|
fail 'Define strong paramaters in controller method resource_params'
|
135
137
|
end
|
136
138
|
|
137
|
-
def sidebar
|
138
|
-
partial = "tenon/#{controller_name.pluralize}/sidebar"
|
139
|
-
partial if File.exist? File.join(Rails.root, 'app', 'views', partial)
|
140
|
-
end
|
141
|
-
|
142
139
|
helper_method :sidebar
|
143
140
|
end
|
144
141
|
end
|
@@ -27,9 +27,11 @@
|
|
27
27
|
= f.text_field :publish_at, label: "Publish Date", data: {behaviour: 'datetime-picker'}, placeholder: '--'
|
28
28
|
|
29
29
|
.row.content
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
- if can?(:publish, @event)
|
31
|
+
%button.btn.btn-comp.btn-block.submit Save
|
32
|
+
- if can?(:create, Tenon::ItemVersion)
|
33
|
+
= save_draft_button(@event)
|
34
|
+
.last-autosave
|
33
35
|
|
34
36
|
%hr
|
35
37
|
.content
|
@@ -23,9 +23,12 @@
|
|
23
23
|
%h4.box-label Publish
|
24
24
|
.box
|
25
25
|
.content
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
- if can?(:publish, @gallery)
|
27
|
+
= f.submit 'Save', class: 'btn btn-block btn-comp'
|
28
|
+
|
29
|
+
- if can?(:create, Tenon::ItemVersion)
|
30
|
+
= save_draft_button(@gallery)
|
31
|
+
.last-autosave
|
29
32
|
|
30
33
|
%hr
|
31
34
|
.content
|
@@ -6,25 +6,25 @@
|
|
6
6
|
%h4 Edit Options
|
7
7
|
%nav
|
8
8
|
%ul
|
9
|
-
%li.active= link_to
|
10
|
-
%li= link_to
|
9
|
+
%li.active= link_to 'Page Content', '#details', data: {toggle: 'tab'}
|
10
|
+
%li= link_to 'Search Optimization', '#seo', data: {toggle: 'tab'}
|
11
11
|
|
12
12
|
= autosaving_form_for @page do |f|
|
13
13
|
= error_messages_for :page
|
14
14
|
.fields.large.tabs
|
15
15
|
.tab-pane.active#details
|
16
16
|
.form-group
|
17
|
-
= f.text_field :title, :
|
17
|
+
= f.text_field :title, explanation: 'This is the title that shows up at the top of your page.'
|
18
18
|
|
19
19
|
.form-group= f.tenon_content :content
|
20
20
|
|
21
|
-
.tab-pane#seo= render
|
21
|
+
.tab-pane#seo= render 'tenon/shared/seo_fields', f: f
|
22
22
|
|
23
23
|
.fields.small
|
24
24
|
%h4.box-label Details
|
25
25
|
.box
|
26
26
|
.form-group.bordered
|
27
|
-
= f.super_label :parent_id,
|
27
|
+
= f.super_label :parent_id, 'Parent Page'
|
28
28
|
= f.collection_select :parent_id, @potential_parents, :id, :option_title, {:include_blank => "(No Parent)"}
|
29
29
|
|
30
30
|
.form-group.inline.bordered
|
@@ -41,13 +41,16 @@
|
|
41
41
|
= f.text_field :publish_at, label: "Publish Date", data: {behaviour: 'datetime-picker'}, placeholder: '--'
|
42
42
|
|
43
43
|
.row.content
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
- if can?(:publish, @page)
|
45
|
+
%button.btn.btn-comp.btn-block.submit Save
|
46
|
+
|
47
|
+
- if can?(:create, Tenon::ItemVersion)
|
48
|
+
= save_draft_button(@page)
|
49
|
+
.last-autosave
|
47
50
|
|
48
51
|
%hr
|
49
52
|
.content
|
50
53
|
= clear_draft_link if params[:version]
|
51
54
|
= load_draft_link(@page)
|
52
55
|
- if @page.persisted?
|
53
|
-
= link_to "Delete", @page, :
|
56
|
+
= link_to "Delete", @page, data: {method: :delete, confirm: 'Are you sure you want to delete this?'}, class: 'delete-link'
|
@@ -51,9 +51,12 @@
|
|
51
51
|
= f.text_field :publish_at, label: "Publish Date", data: {behaviour: 'datetime-picker'}, placeholder: '--'
|
52
52
|
|
53
53
|
.row.content
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
- if can?(:publish, @post)
|
55
|
+
%button.btn.btn-comp.btn-block.submit Save
|
56
|
+
|
57
|
+
- if can?(:create, Tenon::ItemVersion)
|
58
|
+
= save_draft_button(@post)
|
59
|
+
.last-autosave
|
57
60
|
|
58
61
|
%hr
|
59
62
|
.content
|
@@ -0,0 +1,19 @@
|
|
1
|
+
%h4.box-label Contact Details
|
2
|
+
.box
|
3
|
+
.form-group.bordered
|
4
|
+
%label Contact Email
|
5
|
+
.explanation Destination email address for alerts. Separate multiple email addresses with commas.
|
6
|
+
= text_field_tag "settings[contact_email]", Tenon::MySettings.contact_email, :placeholder => "--"
|
7
|
+
|
8
|
+
.form-group.bordered
|
9
|
+
%label Sender Email
|
10
|
+
.explanation "From" email address for alerts.
|
11
|
+
= text_field_tag "settings[from_email]", Tenon::MySettings.from_email, :placeholder => "--"
|
12
|
+
|
13
|
+
%h4.box-label Comment Notifications
|
14
|
+
.box
|
15
|
+
.form-group.inline.bordered
|
16
|
+
= check_box_tag "settings[comment_email]", 1, Tenon::MySettings.comment_email, class: 'tn-checkbox-right'
|
17
|
+
%label{for: 'settings_comment_email'} Comment Email
|
18
|
+
.explanation Do you want to receive an email when someone posts a comment?
|
19
|
+
|
@@ -1,40 +1,12 @@
|
|
1
|
-
.
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
= text_area_tag "settings[google_analytics]", Tenon::MySettings.google_analytics, :style => "height: 180px;"
|
14
|
-
|
15
|
-
.fields.small
|
16
|
-
%h4.box-label Details
|
17
|
-
.box
|
18
|
-
.form-group.inline.bordered
|
19
|
-
= check_box_tag "settings[comment_email]", 1, Tenon::MySettings.comment_email, class: 'tn-checkbox-right'
|
20
|
-
%label{for: 'settings_comment_email'} Comment Email
|
21
|
-
.explanation Do you want to receive an email when someone posts a comment?
|
22
|
-
|
23
|
-
.form-group.bordered
|
24
|
-
%label Contact Email
|
25
|
-
.explanation Destination email address for alerts. Separate multiple email addresses with commas.
|
26
|
-
= text_field_tag "settings[contact_email]", Tenon::MySettings.contact_email, :placeholder => "--"
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
.form-group.bordered
|
31
|
-
%label Sender Email
|
32
|
-
.explanation "From" email address for alerts.
|
33
|
-
= text_field_tag "settings[from_email]", Tenon::MySettings.from_email, :placeholder => "--"
|
34
|
-
|
35
|
-
%h4.box-label Actions
|
36
|
-
.box
|
37
|
-
.content
|
38
|
-
%button.btn.btn-comp.btn-block.submit Save
|
39
|
-
|
40
|
-
.spacer
|
1
|
+
.form-group
|
2
|
+
%label Site Name
|
3
|
+
= text_field_tag 'settings[site_title]', Tenon::MySettings.site_title
|
4
|
+
|
5
|
+
.form-group
|
6
|
+
%label Site Domain
|
7
|
+
= text_field_tag 'settings[site_url]', Tenon::MySettings.site_url
|
8
|
+
|
9
|
+
.form-group
|
10
|
+
%label Google Analytics Code
|
11
|
+
.explanation= link_to 'Create a New Profile Here', 'https://www.google.com/analytics/settings/add_profile?scid=16153080', target: '_'
|
12
|
+
= text_area_tag 'settings[google_analytics]', Tenon::MySettings.google_analytics, style: 'height: 180px;'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
.form-group
|
2
|
+
%label META Keywords
|
3
|
+
.explanation These META keywords will be used by some search engines when crawling your site. Separate keywords with a comma. Note: Google does not factor in keywords when calculating your rank. Other search engines may or may not.
|
4
|
+
= text_area_tag "settings[seo_keywords]", Tenon::MySettings.seo_keywords
|
5
|
+
|
6
|
+
.form-group
|
7
|
+
%label META Description
|
8
|
+
.explanation This description will show up on search engines and in some cases will affect your rank. It should be no longer than 150-160 characters (about the length of a tweet.)
|
9
|
+
= text_area_tag "settings[seo_description]", Tenon::MySettings.seo_description
|
10
|
+
|
@@ -7,6 +7,8 @@
|
|
7
7
|
%nav
|
8
8
|
%ul
|
9
9
|
%li.active= link_to "General Settings", '#general', data: {toggle: 'tab'}
|
10
|
+
%li= link_to 'Contact Management', '#contact', data: {toggle: 'tab'}
|
11
|
+
%li= link_to 'Search Optimization', '#seo', data: {toggle: 'tab'}
|
10
12
|
|
11
13
|
%header
|
12
14
|
%h1 Site Settings
|
@@ -16,5 +18,14 @@
|
|
16
18
|
|
17
19
|
.main-content
|
18
20
|
= form_tag({:action => :update}, :method => "PUT") do
|
19
|
-
.tabs
|
20
|
-
#general.tab-pane.active= render :partial =>
|
21
|
+
.fields.large.tabs
|
22
|
+
#general.tab-pane.active= render :partial => 'general'
|
23
|
+
#contact.tab-pane= render :partial => 'contact'
|
24
|
+
#seo.tab-pane= render :partial => 'seo'
|
25
|
+
|
26
|
+
.fields.small
|
27
|
+
%h4.box-label Actions
|
28
|
+
.box
|
29
|
+
.content
|
30
|
+
%button.btn.btn-primary.btn-block.submit Save
|
31
|
+
|
@@ -1,5 +1,8 @@
|
|
1
1
|
%h4 Posts
|
2
2
|
%nav
|
3
3
|
%ul
|
4
|
-
|
5
|
-
|
4
|
+
- if can?(:manage, Tenon::Post)
|
5
|
+
%li{class: ('active' if controller_name == 'posts')}= link_to "Posts", posts_path
|
6
|
+
|
7
|
+
- if can?(:manage, Tenon::PostCategory)
|
8
|
+
%li{class: ('active' if controller_name == 'post_categories')}= link_to "Post Categories", post_categories_path
|
@@ -63,15 +63,16 @@
|
|
63
63
|
= f.text_field :publish_at, label: 'Publish Date', data: {behaviour: 'datetime-picker'}, placeholder: '--'
|
64
64
|
<% end -%>
|
65
65
|
.content
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
- if can?(:publish, @<%= singular_name %>)
|
67
|
+
%button.btn.btn-block.btn-comp Save
|
68
|
+
- if can?(:create, Tenon::ItemVersion)
|
69
|
+
= save_draft_button(@<%= singular_name %>)
|
70
|
+
.last-autosave
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
= link_to "Delete", @<%= singular_name %>, data: {method: :delete, confirm: 'Are you sure you want to delete this?'}, :class => 'delete-link'
|
72
|
+
%hr
|
73
|
+
.content
|
74
|
+
= clear_draft_link if params[:version]
|
75
|
+
= load_draft_link(@<%= singular_name %>)
|
76
|
+
- if @<%= singular_name %>.persisted?
|
77
|
+
= link_to "Delete", @<%= singular_name %>, data: {method: :delete, confirm: 'Are you sure you want to delete this?'}, :class => 'delete-link'
|
77
78
|
.spacer
|
data/lib/tenon/i18n_lookup.rb
CHANGED
@@ -13,10 +13,12 @@ module Tenon
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.set_fields
|
16
|
+
default = { tables: {} }
|
16
17
|
if File.exist?(config_file)
|
17
|
-
YAML.load(File.open(config_file)).recursive_symbolize_keys!
|
18
|
+
result = YAML.load(File.open(config_file)).recursive_symbolize_keys!
|
19
|
+
result || default
|
18
20
|
else
|
19
|
-
|
21
|
+
default
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
data/lib/tenon/version.rb
CHANGED
@@ -14,9 +14,13 @@ describe 'An admin', js: true do
|
|
14
14
|
Tenon::MySettings.site_title = 'Site Title'
|
15
15
|
Tenon::MySettings.site_url = 'http://google.com'
|
16
16
|
Tenon::MySettings.google_analytics = '<script></script>'
|
17
|
+
|
17
18
|
Tenon::MySettings.comment_email = true
|
18
19
|
Tenon::MySettings.contact_email = 'info@factore.ca'
|
19
20
|
Tenon::MySettings.from_email = 'noreply@factore.ca'
|
21
|
+
|
22
|
+
Tenon::MySettings.seo_keywords = 'keywords'
|
23
|
+
Tenon::MySettings.seo_description = 'description'
|
20
24
|
end
|
21
25
|
|
22
26
|
it 'should see all the settings in the form' do
|
@@ -24,9 +28,15 @@ describe 'An admin', js: true do
|
|
24
28
|
expect(page.find('#settings_site_title').value).to eq(Tenon::MySettings.site_title)
|
25
29
|
expect(page.find('#settings_site_url').value).to eq(Tenon::MySettings.site_url)
|
26
30
|
expect(page.find('#settings_google_analytics').value).to eq(Tenon::MySettings.google_analytics)
|
31
|
+
|
32
|
+
click_on 'Contact Management'
|
27
33
|
expect(page.find('#settings_contact_email').value).to eq(Tenon::MySettings.contact_email)
|
28
34
|
expect(page.find('#settings_from_email').value).to eq(Tenon::MySettings.from_email)
|
29
35
|
expect(page.find('#settings_comment_email')).to be_checked
|
36
|
+
|
37
|
+
click_on 'Search Optimization'
|
38
|
+
expect(page.find('#settings_seo_keywords').value).to eq(Tenon::MySettings.seo_keywords)
|
39
|
+
expect(page.find('#settings_seo_description').value).to eq(Tenon::MySettings.seo_description)
|
30
40
|
end
|
31
41
|
end
|
32
42
|
|
@@ -36,17 +46,29 @@ describe 'An admin', js: true do
|
|
36
46
|
fill_in 'settings[site_title]', with: 'New Site Title'
|
37
47
|
fill_in 'settings[site_url]', with: 'http://factore.ca'
|
38
48
|
fill_in 'settings[google_analytics]', with: 'analytics'
|
49
|
+
|
50
|
+
click_on 'Contact Management'
|
39
51
|
fill_in 'settings[contact_email]', with: 'contact@factore.ca'
|
40
52
|
fill_in 'settings[from_email]', with: 'reply@factore.ca'
|
53
|
+
|
54
|
+
click_on 'Search Optimization'
|
55
|
+
fill_in 'settings[seo_keywords]', with: 'more, keyword'
|
56
|
+
fill_in 'settings[seo_description]', with: 'the description'
|
41
57
|
click_button 'Save'
|
42
58
|
|
43
59
|
visit settings_path
|
44
60
|
expect(page.find('#settings_site_title').value).to eq('New Site Title')
|
45
61
|
expect(page.find('#settings_site_url').value).to eq('http://factore.ca')
|
46
62
|
expect(page.find('#settings_google_analytics').value).to eq('analytics')
|
63
|
+
|
64
|
+
click_on 'Contact Management'
|
47
65
|
expect(page.find('#settings_contact_email').value).to eq('contact@factore.ca')
|
48
66
|
expect(page.find('#settings_from_email').value).to eq('reply@factore.ca')
|
49
67
|
expect(page.find('#settings_comment_email')).not_to be_checked
|
68
|
+
|
69
|
+
click_on 'Search Optimization'
|
70
|
+
expect(page.find('#settings_seo_keywords').value).to eq('more, keyword')
|
71
|
+
expect(page.find('#settings_seo_description').value).to eq('the description')
|
50
72
|
end
|
51
73
|
end
|
52
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tenon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- factor[e] design initiative
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: better_errors
|
@@ -1183,7 +1183,9 @@ files:
|
|
1183
1183
|
- app/views/tenon/posts/index.html.haml
|
1184
1184
|
- app/views/tenon/posts/index.json.jbuilder
|
1185
1185
|
- app/views/tenon/posts/new.html.haml
|
1186
|
+
- app/views/tenon/settings/_contact.html.haml
|
1186
1187
|
- app/views/tenon/settings/_general.html.haml
|
1188
|
+
- app/views/tenon/settings/_seo.html.haml
|
1187
1189
|
- app/views/tenon/settings/show.html.haml
|
1188
1190
|
- app/views/tenon/shared/_asset_field.html.haml
|
1189
1191
|
- app/views/tenon/shared/_main_nav.html.haml
|