pageflow 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pageflow might be problematic. Click here for more details.
- checksums.yaml +8 -8
- data/admins/pageflow/user.rb +9 -12
- data/app/assets/images/pageflow/close_sprite_shadow.png +0 -0
- data/app/assets/images/pageflow/close_sprite_shadow_ie8.png +0 -0
- data/app/assets/images/pageflow/close_text_invert.png +0 -0
- data/app/assets/images/pageflow/themes/default/logo_header_invert.png +0 -0
- data/app/assets/javascripts/pageflow/asset_urls.js.erb +0 -1
- data/app/assets/javascripts/pageflow/editor/controllers/sidebar_controller.js +1 -1
- data/app/assets/javascripts/pageflow/editor/models/quota.js +18 -0
- data/app/assets/javascripts/pageflow/editor/templates/back_button_decorator.jst.ejs +2 -0
- data/app/assets/javascripts/pageflow/editor/templates/help.jst.ejs.erb +2 -2
- data/app/assets/javascripts/pageflow/editor/templates/publish_entry.jst.ejs +0 -2
- data/app/assets/javascripts/pageflow/editor/templates/quota_decorator.jst.ejs +6 -0
- data/app/assets/javascripts/pageflow/editor/views/back_button_decorator_view.js +19 -0
- data/app/assets/javascripts/pageflow/editor/views/publish_entry_view.js +9 -6
- data/app/assets/javascripts/pageflow/editor/views/quota_decorator_view.js +45 -0
- data/app/assets/stylesheets/pageflow/admin.css.scss +1 -0
- data/app/assets/stylesheets/pageflow/admin/quotas.css.scss +7 -0
- data/app/assets/stylesheets/pageflow/editor/base.css.scss +1 -0
- data/app/assets/stylesheets/pageflow/editor/publish_entry.css.scss +0 -1
- data/app/assets/stylesheets/pageflow/editor/quotas.css.scss +17 -0
- data/app/assets/stylesheets/pageflow/navigation_mobile.css.scss +0 -1
- data/app/assets/stylesheets/pageflow/page.css.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/navigation.css.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/page.css.scss +2 -2
- data/app/controllers/concerns/pageflow/quota_verification.rb +28 -0
- data/app/controllers/pageflow/editor/quotas_controller.rb +13 -0
- data/app/controllers/pageflow/revisions_controller.rb +5 -0
- data/app/helpers/pageflow/quota_helper.rb +11 -0
- data/app/helpers/pageflow/render_json_helper.rb +6 -0
- data/app/jobs/pageflow/poll_zencoder_job.rb +3 -0
- data/app/jobs/pageflow/submit_file_to_zencoder_job.rb +3 -0
- data/app/mailers/pageflow/user_mailer.rb +1 -3
- data/app/views/admin/users/_form.html.erb +20 -0
- data/app/views/admin/users/_quota_exceeded.html.erb +1 -0
- data/app/views/pageflow/editor/quotas/_published_entries_exceeded.html.erb +1 -0
- data/app/views/pageflow/editor/quotas/show.json.jbuilder +5 -0
- data/app/views/pageflow/entries/_entry.html.erb +1 -1
- data/config/locales/editor/quotas.de.yml +4 -0
- data/config/locales/quotas.de.yml +3 -0
- data/config/routes.rb +2 -0
- data/config/spring.rb +1 -0
- data/lib/generators/pageflow/initializer/templates/pageflow.rb +4 -0
- data/lib/generators/pageflow/resque/resque_generator.rb +1 -0
- data/lib/generators/pageflow/resque/templates/resque.rake +7 -0
- data/lib/pageflow/configuration.rb +26 -0
- data/lib/pageflow/engine.rb +8 -0
- data/lib/pageflow/hooks.rb +19 -0
- data/lib/pageflow/quota.rb +35 -0
- data/lib/pageflow/version.rb +1 -1
- metadata +26 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWMxNjk3NzZlZGVhYTdjMDQ0NWE0MTRmMThjZTMxOTdlZjE3YjBjOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGQ1MmIzN2E5YzdmMzY5ZTVmODYyMDJkNzg5ZGEzOTQ1OGY3MTllYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjNkYTQzOTNjY2FjOThhNzliODRkOTNhNzdhY2U2YzUyYjlkYzgzNjZkODI4
|
10
|
+
NDZhY2RjZTRkM2JkMDkyNDdjYmJiYzdlZDNhOGU1Mjc1NDY0MmRkOGNkZThl
|
11
|
+
ZTNkMDVlN2EzMGU1MDljNDA2OWZiMjJhNTYxYjg5NzM1Yjc3MzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzA3NTJiNWE0MDM4YWEyNWFhYWQzMzE4MTBjZTNjZDBmZWE0NTA4YmMzYzZi
|
14
|
+
YTRmNDUxMWVjMWY2OTNjZTViNmVmMTExMDg5ODRlMWIwZWNkMDA3ZGZkZGVh
|
15
|
+
ZjdiMTQ5N2YxMmM2OGQxMWY0NjRiZTIwZTZkODgxYWZhOGQ2ZGM=
|
data/admins/pageflow/user.rb
CHANGED
@@ -104,18 +104,7 @@ module Pageflow
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
form
|
108
|
-
f.inputs "Details" do
|
109
|
-
f.input :email, :hint => f.object.new_record? && I18n.t('admin.users.email_invitation_hint')
|
110
|
-
f.input :first_name
|
111
|
-
f.input :last_name
|
112
|
-
if authorized?(:read, Account)
|
113
|
-
f.input :account, :include_blank => false
|
114
|
-
end
|
115
|
-
f.input :role, :collection => collection_for_user_roles, :include_blank => false, :hint => authorized?(:read, Account) ? I18n.t('admin.users.role_hint.admin') : I18n.t('admin.users.role_hint.other')
|
116
|
-
end
|
117
|
-
f.actions
|
118
|
-
end
|
107
|
+
form(:partial => 'form')
|
119
108
|
|
120
109
|
collection_action 'me', :title => 'Profil', :method => [:get, :patch] do
|
121
110
|
if request.patch?
|
@@ -150,7 +139,10 @@ module Pageflow
|
|
150
139
|
end
|
151
140
|
|
152
141
|
controller do
|
142
|
+
include Pageflow::QuotaVerification
|
143
|
+
|
153
144
|
helper Pageflow::UsersHelper
|
145
|
+
helper Pageflow::QuotaHelper
|
154
146
|
|
155
147
|
def build_new_resource
|
156
148
|
user = InvitedUser.new(permitted_params[:user])
|
@@ -158,6 +150,11 @@ module Pageflow
|
|
158
150
|
user
|
159
151
|
end
|
160
152
|
|
153
|
+
def create_resource(user)
|
154
|
+
verify_quota!(:users, resource.account)
|
155
|
+
super
|
156
|
+
end
|
157
|
+
|
161
158
|
def user_profile_params
|
162
159
|
params.require(:user).permit(:first_name, :last_name, :current_password, :password, :password_confirmation)
|
163
160
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,6 +1,5 @@
|
|
1
1
|
pageflow.assetUrls = {
|
2
2
|
largeBandwidthProbe: '<%= Rails.env.test? ? asset_path("bandwidth_probe_large.png") : "http://#{File.join(Pageflow.config.zencoder_options[:s3_host_alias], "bandwidth_probe_large.png")}" %>',
|
3
|
-
|
4
3
|
smallBandwidthProbe: '<%= Rails.env.test? ? asset_path("bandwidth_probe_small.png") : "http://#{File.join(Pageflow.config.zencoder_options[:s3_host_alias], "bandwidth_probe_small.png")}" %>',
|
5
4
|
audioSwf: '<%= asset_path "pageflow/audio5js.swf" %>',
|
6
5
|
emptyMp4: '<%= asset_path "pageflow/empty.mp4" %>',
|
@@ -0,0 +1,18 @@
|
|
1
|
+
pageflow.Quota = Backbone.Model.extend({
|
2
|
+
modelName: 'quota',
|
3
|
+
paramRoot: 'quota',
|
4
|
+
|
5
|
+
url: function() {
|
6
|
+
return '/editor/quotas/' + this.id;
|
7
|
+
},
|
8
|
+
|
9
|
+
isExceeded: function() {
|
10
|
+
return this.get('state') === 'exceeded';
|
11
|
+
}
|
12
|
+
});
|
13
|
+
|
14
|
+
pageflow.Quota.byName = function(name, options) {
|
15
|
+
return new pageflow.Quota({
|
16
|
+
id: name
|
17
|
+
}, options);
|
18
|
+
};
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<ul>
|
5
5
|
<li data-section="intro"><a href="">Übersicht</a></li>
|
6
6
|
<li data-section="outline"><a href="">Kapitel und Seiten verwalten</a></li>
|
7
|
-
<li data-section="page"><a href="">Seiten
|
7
|
+
<li data-section="page"><a href="">Seiten konfigurieren</a></li>
|
8
8
|
<li data-section="files"><a href="">Dateien hochladen und verwalten</a></li>
|
9
9
|
<li data-section="reusing_files"><a href="">Dateien wiederverwenden</a></li>
|
10
10
|
<li data-section="options"><a href="">Weitere Optionen</a></li>
|
@@ -57,7 +57,7 @@
|
|
57
57
|
</section>
|
58
58
|
|
59
59
|
<section data-name="page">
|
60
|
-
<h3>Seiten
|
60
|
+
<h3>Seiten konfigurieren</h3>
|
61
61
|
|
62
62
|
<p>
|
63
63
|
Wählen Sie zunächst einen Seitentyp.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
pageflow.BackButtonDecoratorView = Backbone.Marionette.Layout.extend({
|
2
|
+
template: 'templates/back_button_decorator',
|
3
|
+
|
4
|
+
events: {
|
5
|
+
'click a.back': 'goBack',
|
6
|
+
},
|
7
|
+
|
8
|
+
regions: {
|
9
|
+
outlet: '.outlet'
|
10
|
+
},
|
11
|
+
|
12
|
+
onRender: function() {
|
13
|
+
this.outlet.show(this.options.view);
|
14
|
+
},
|
15
|
+
|
16
|
+
goBack: function() {
|
17
|
+
editor.navigate('/', {trigger: true});
|
18
|
+
}
|
19
|
+
});
|
@@ -14,8 +14,6 @@ pageflow.PublishEntryView = Backbone.Marionette.ItemView.extend({
|
|
14
14
|
},
|
15
15
|
|
16
16
|
events: {
|
17
|
-
'click a.back': 'goBack',
|
18
|
-
|
19
17
|
'click button.save': 'save',
|
20
18
|
|
21
19
|
'click input#publish_entry_forever': 'enablePublishForever',
|
@@ -72,10 +70,6 @@ pageflow.PublishEntryView = Backbone.Marionette.ItemView.extend({
|
|
72
70
|
}
|
73
71
|
},
|
74
72
|
|
75
|
-
goBack: function() {
|
76
|
-
editor.navigate('/', {trigger: true});
|
77
|
-
},
|
78
|
-
|
79
73
|
save: function() {
|
80
74
|
var publishedUntil = null;
|
81
75
|
|
@@ -189,3 +183,12 @@ pageflow.PublishEntryView = Backbone.Marionette.ItemView.extend({
|
|
189
183
|
return true;
|
190
184
|
}
|
191
185
|
});
|
186
|
+
|
187
|
+
pageflow.PublishEntryView.create = function(options) {
|
188
|
+
return new pageflow.BackButtonDecoratorView({
|
189
|
+
view: new pageflow.QuotaDecoratorView({
|
190
|
+
model: pageflow.Quota.byName('published_entries'),
|
191
|
+
view: new pageflow.PublishEntryView(options)
|
192
|
+
})
|
193
|
+
});
|
194
|
+
};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
pageflow.QuotaDecoratorView = Backbone.Marionette.Layout.extend({
|
2
|
+
template: 'templates/quota_decorator',
|
3
|
+
className: 'quota_decorator',
|
4
|
+
|
5
|
+
regions: {
|
6
|
+
outlet: '.outlet'
|
7
|
+
},
|
8
|
+
|
9
|
+
ui: {
|
10
|
+
state: '.quota_state',
|
11
|
+
exceededMessage: '.exceeded_message'
|
12
|
+
},
|
13
|
+
|
14
|
+
onRender: function() {
|
15
|
+
var view = this;
|
16
|
+
|
17
|
+
view.ui.state.text(I18n.t('editor.quotas.loading'));
|
18
|
+
view.ui.exceededMessage.html('');
|
19
|
+
view.outlet.close();
|
20
|
+
|
21
|
+
view.model.fetch({
|
22
|
+
success: function() {
|
23
|
+
if (view.model.isExceeded()) {
|
24
|
+
view.ui.state.hide();
|
25
|
+
view.ui.exceededMessage.html(view.model.get('exceeded_html'));
|
26
|
+
}
|
27
|
+
else {
|
28
|
+
if (view.model.get('state_description')) {
|
29
|
+
view.ui.state.text(view.model.get('state_description'));
|
30
|
+
view.ui.state.show();
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
view.ui.state.hide();
|
34
|
+
}
|
35
|
+
|
36
|
+
view.outlet.show(view.options.view);
|
37
|
+
}
|
38
|
+
},
|
39
|
+
|
40
|
+
error: function() {
|
41
|
+
view.ui.state.text(I18n.t('editor.quota.error'));
|
42
|
+
}
|
43
|
+
});
|
44
|
+
}
|
45
|
+
});
|
@@ -0,0 +1,17 @@
|
|
1
|
+
.quota_decorator {
|
2
|
+
.exceeded_message {
|
3
|
+
margin: 10px 0;
|
4
|
+
|
5
|
+
p {
|
6
|
+
margin-bottom: 10px;
|
7
|
+
}
|
8
|
+
}
|
9
|
+
|
10
|
+
.quota_state {
|
11
|
+
@include background-icon-left($left: 7px, $top: 18px);
|
12
|
+
@include gauge-icon;
|
13
|
+
|
14
|
+
padding: 10px 10px 10px 40px;
|
15
|
+
border-bottom: solid 1px #aaa;
|
16
|
+
}
|
17
|
+
}
|
@@ -281,7 +281,7 @@ $nav-bg-color-transparent: $basic-background-color-transparent;
|
|
281
281
|
}
|
282
282
|
|
283
283
|
.overview_mobile .credits a:before, .navigation_credits_box a:before {
|
284
|
-
background-image: image-url('pageflow/themes/#{$theme-name}/
|
284
|
+
background-image: image-url('pageflow/themes/#{$theme-name}/anchor_main_color.png');
|
285
285
|
}
|
286
286
|
|
287
287
|
.navigation .navigation_home.deactivated .button {
|
@@ -79,7 +79,7 @@ $page-color: $main-color;
|
|
79
79
|
.content_and_background .scroller > div:after {
|
80
80
|
content: " ";
|
81
81
|
position: absolute;
|
82
|
-
background-image: image-url("pageflow/themes/#{$theme-name}/
|
82
|
+
background-image: image-url("pageflow/themes/#{$theme-name}/logo_header.png");
|
83
83
|
background-repeat: no-repeat;
|
84
84
|
top: 50px;
|
85
85
|
z-index: 200;
|
@@ -93,7 +93,7 @@ $page-color: $main-color;
|
|
93
93
|
}
|
94
94
|
|
95
95
|
&.invert .content_and_background .scroller > div:after {
|
96
|
-
background-image: image-url("pageflow/themes/#{$theme-name}/
|
96
|
+
background-image: image-url("pageflow/themes/#{$theme-name}/logo_header_invert.png");
|
97
97
|
}
|
98
98
|
|
99
99
|
.scroller > div, .content_and_background > .page_header {
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Pageflow
|
2
|
+
module QuotaVerification
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
rescue_from Quota::ExceededError do |exception|
|
7
|
+
respond_to do |format|
|
8
|
+
format.html do
|
9
|
+
redirect_to :back, :alert => t('quotas.exceeded')
|
10
|
+
end
|
11
|
+
format.json do
|
12
|
+
render(:status => :forbidden,
|
13
|
+
:json => {
|
14
|
+
:error_message => exception.message,
|
15
|
+
:quota_name => exception.quota_name
|
16
|
+
})
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
def verify_quota!(name, account)
|
25
|
+
Pageflow.config.quota.verify!(name, account)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Pageflow
|
2
|
+
module Editor
|
3
|
+
class QuotasController < Pageflow::ApplicationController
|
4
|
+
before_filter :authenticate_user!
|
5
|
+
|
6
|
+
def show
|
7
|
+
@account = current_user.account
|
8
|
+
@quota_name = params[:id]
|
9
|
+
@quota = Pageflow.config.quota
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,13 +1,18 @@
|
|
1
1
|
module Pageflow
|
2
2
|
class RevisionsController < Pageflow::ApplicationController
|
3
|
+
include QuotaVerification
|
4
|
+
|
3
5
|
before_filter :authenticate_user!, :unless => lambda { |controller| controller.request.format.css? }
|
4
6
|
|
5
7
|
respond_to :json
|
6
8
|
|
7
9
|
def create
|
8
10
|
entry = Entry.find(params[:entry_id])
|
11
|
+
|
9
12
|
authorize!(:publish, entry)
|
10
13
|
verify_edit_lock!(entry)
|
14
|
+
verify_quota!(:published_entries, entry.account)
|
15
|
+
|
11
16
|
@revision = entry.publish(revision_params.merge(:creator => current_user))
|
12
17
|
end
|
13
18
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Pageflow
|
2
|
+
module QuotaHelper
|
3
|
+
def quota_state_description(name, account)
|
4
|
+
description = Pageflow.config.quota.state_description(:users, @user.account)
|
5
|
+
|
6
|
+
if description
|
7
|
+
content_tag(:p, description, :class => 'quota_state')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -21,6 +21,12 @@ module Pageflow
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def render_html_partial(*args)
|
25
|
+
render_with_format(:html) do
|
26
|
+
render(*args)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
24
30
|
def render_with_format(format, &block)
|
25
31
|
old_formats = formats
|
26
32
|
self.formats = [format] # hack so partials resolve with json not html format
|
@@ -2,11 +2,9 @@ module Pageflow
|
|
2
2
|
class UserMailer < ActionMailer::Base
|
3
3
|
include Resque::Mailer
|
4
4
|
|
5
|
-
default :from => "pageflow@codevise.de"
|
6
|
-
|
7
5
|
def invitation(options)
|
8
6
|
@user = User.find(options['user_id'])
|
9
|
-
mail(:to => @user.email, :subject => t('.subject'))
|
7
|
+
mail(:to => @user.email, :subject => t('.subject'), :from => Pageflow.config.mailer_sender)
|
10
8
|
end
|
11
9
|
end
|
12
10
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<% if @user.new_record? && Pageflow.config.quota.exceeded?(:users, @user.account) %>
|
2
|
+
<%= render 'admin/users/quota_exceeded' %>
|
3
|
+
<% else %>
|
4
|
+
<%= semantic_form_for([:admin, @user.becomes(User)]) do |f| %>
|
5
|
+
<%= f.inputs "Details" do %>
|
6
|
+
<% if @user.new_record? %>
|
7
|
+
<%= quota_state_description(:users, @user.account) %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<%= f.input :email, :hint => f.object.new_record? && I18n.t('admin.users.email_invitation_hint') %>
|
11
|
+
<%= f.input :first_name %>
|
12
|
+
<%= f.input :last_name %>
|
13
|
+
<% if authorized?(:read, Pageflow::Account) %>
|
14
|
+
<%= f.input :account, :include_blank => false %>
|
15
|
+
<% end %>
|
16
|
+
<%= f.input :role, :collection => collection_for_user_roles, :include_blank => false, :hint => authorized?(:read, Pageflow::Account) ? I18n.t('admin.users.role_hint.admin') : I18n.t('admin.users.role_hint.other') %>
|
17
|
+
<% end %>
|
18
|
+
<%= f.actions %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>Replace by creating <code>app/views/admin/users/_quota_exceeded.html.erb</code></p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>Replace by creating <code>app/views/pageflow/editor/quotas/_published_entries_exceeded.html.erb</code></p>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
json.name(@quota_name)
|
2
|
+
|
3
|
+
json.state_description(@quota.state_description(@quota_name, @account))
|
4
|
+
json.state(@quota.exceeded?(@quota_name, @account) ? 'exceeded' : 'ok')
|
5
|
+
json.exceeded_html(render_html_partial('pageflow/editor/quotas/published_entries_exceeded', :account => @account))
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div id="outer_wrapper">
|
2
2
|
<%= render 'pageflow/entries/skip_links' %>
|
3
3
|
<h1 class="hidden"><%= entry.title %></h1>
|
4
|
-
<img src="<%= image_path(
|
4
|
+
<img src="<%= image_path("pageflow/themes/#{entry.theme.name}/logo_print.png") %>" class="print_image" alt="Logo image for print version">
|
5
5
|
<span class="print_only page_url"><%= request.original_url %></span>
|
6
6
|
<%= content_tag :div, :id => 'content', :class => 'entry', :data => {:role => 'slideshow'} do %>
|
7
7
|
<%= render entry.pages %>
|
data/config/routes.rb
CHANGED
data/config/spring.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Spring.application_root = File.join(__FILE__, '../../spec/dummy')
|
@@ -2,6 +2,10 @@
|
|
2
2
|
ActiveAdmin.application.load_paths.unshift(Dir[Pageflow::Engine.root.join('admins')])
|
3
3
|
|
4
4
|
Pageflow.configure do |config|
|
5
|
+
# The email address to use as from header in invitation mails to new
|
6
|
+
# users.
|
7
|
+
config.mailer_sender = 'change-me-in-at-config-initializers-pageflow@example.com'
|
8
|
+
|
5
9
|
# Page types available in the editor. Add futher page types from
|
6
10
|
# page type engines below.
|
7
11
|
config.register_page_type(Pageflow::BuiltInPageType.background_image)
|
@@ -11,6 +11,7 @@ module Pageflow
|
|
11
11
|
template 'resque_logger.rb', 'config/initializers/resque_logger.rb'
|
12
12
|
template 'resque_enqueue_after_commit_patch.rb', 'config/initializers/resque_enqueue_after_commit_patch.rb'
|
13
13
|
template 'devise_async.rb', 'config/initializers/devise_async.rb'
|
14
|
+
template 'resque.rake', 'lib/tasks/resque.rake'
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -29,11 +29,37 @@ module Pageflow
|
|
29
29
|
# CNAMES are used to access the public end points of pageflow.
|
30
30
|
attr_accessor :editor_route_constraint
|
31
31
|
|
32
|
+
# The email address to use as from header in invitation mails to
|
33
|
+
# new users
|
34
|
+
attr_accessor :mailer_sender
|
35
|
+
|
36
|
+
# Subscribe to hooks in order to be notified of events. Any object
|
37
|
+
# with a call method can be a subscriber
|
38
|
+
#
|
39
|
+
# Example:
|
40
|
+
#
|
41
|
+
# config.hooks.subscribe(:submit_file, -> { do_something })
|
42
|
+
#
|
43
|
+
attr_reader :hooks
|
44
|
+
|
45
|
+
# Limit the use of certain resources. Any object implementing the
|
46
|
+
# interface of Pageflow::Quota is allowed.
|
47
|
+
attr_accessor :quota
|
48
|
+
|
32
49
|
def initialize
|
33
50
|
@paperclip_filesystem_default_options = {}
|
34
51
|
@paperclip_s3_default_options = {}
|
35
52
|
|
36
53
|
@zencoder_options = {}
|
54
|
+
|
55
|
+
@mailer_sender = 'pageflow@example.com'
|
56
|
+
|
57
|
+
@hooks = Hooks.new
|
58
|
+
@quota = Quota::Unlimited.new
|
59
|
+
end
|
60
|
+
|
61
|
+
def on(*args)
|
62
|
+
hooks.on(*args)
|
37
63
|
end
|
38
64
|
|
39
65
|
# Make a page type available for use in the system.
|
data/lib/pageflow/engine.rb
CHANGED
@@ -47,6 +47,14 @@ module Pageflow
|
|
47
47
|
config.i18n.reload!
|
48
48
|
end
|
49
49
|
|
50
|
+
# Precompile additional assets. pageflow/editor.* has to be
|
51
|
+
# provided by the main app.
|
52
|
+
config.assets.precompile += %w(pageflow/editor.js pageflow/editor.css
|
53
|
+
pageflow/print_view.css
|
54
|
+
pageflow/themes/default.css
|
55
|
+
pageflow/lt_ie9.js pageflow/lt_ie9.css pageflow/ie9.js pageflow/ie9.css
|
56
|
+
video-js.swf vjs.eot vjs.svg vjs.ttf vjs.woff)
|
57
|
+
|
50
58
|
# Make sure the configuration is recreated when classes are
|
51
59
|
# reloded. Otherwise registered page types might still point to
|
52
60
|
# unloaded classes in development mode.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Pageflow
|
2
|
+
class Hooks
|
3
|
+
def initialize
|
4
|
+
@subscribers = Hash.new do |hash, key|
|
5
|
+
hash[key] = []
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def on(event, subscriber)
|
10
|
+
@subscribers[event] << subscriber
|
11
|
+
end
|
12
|
+
|
13
|
+
def invoke(event, *args)
|
14
|
+
@subscribers[event].each do |subscriber|
|
15
|
+
subscriber.call(*args)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Pageflow
|
2
|
+
module Quota
|
3
|
+
class ExceededError < RuntimeError
|
4
|
+
attr_reader :quota_name
|
5
|
+
|
6
|
+
def initialize(quota_name)
|
7
|
+
@quota_name = quota_name
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def exceeded?(name, account)
|
12
|
+
raise(NotImplementedError, 'Quota#exceeded? must be implemented.')
|
13
|
+
end
|
14
|
+
|
15
|
+
def state_description(name, account)
|
16
|
+
raise(NotImplementedError, 'Quota#state_description must be implemented.')
|
17
|
+
end
|
18
|
+
|
19
|
+
def verify!(name, account)
|
20
|
+
raise(ExceededError.new(name), "Quota #{name} exceeded.") if exceeded?(name, account)
|
21
|
+
end
|
22
|
+
|
23
|
+
class Unlimited
|
24
|
+
include Quota
|
25
|
+
|
26
|
+
def exceeded?(name, account)
|
27
|
+
false
|
28
|
+
end
|
29
|
+
|
30
|
+
def state_description(name, account)
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/pageflow/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pageflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Codevise Solutions Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -681,7 +681,10 @@ files:
|
|
681
681
|
- app/assets/images/pageflow/chapter_start.png
|
682
682
|
- app/assets/images/pageflow/chapter_top.png
|
683
683
|
- app/assets/images/pageflow/close_sprite.png
|
684
|
+
- app/assets/images/pageflow/close_sprite_shadow.png
|
685
|
+
- app/assets/images/pageflow/close_sprite_shadow_ie8.png
|
684
686
|
- app/assets/images/pageflow/close_text.png
|
687
|
+
- app/assets/images/pageflow/close_text_invert.png
|
685
688
|
- app/assets/images/pageflow/down.png
|
686
689
|
- app/assets/images/pageflow/down_invert.png
|
687
690
|
- app/assets/images/pageflow/down_small.png
|
@@ -732,6 +735,7 @@ files:
|
|
732
735
|
- app/assets/images/pageflow/themes/default/loading_spinner.png
|
733
736
|
- app/assets/images/pageflow/themes/default/loading_spinner_bg.png
|
734
737
|
- app/assets/images/pageflow/themes/default/logo_header.png
|
738
|
+
- app/assets/images/pageflow/themes/default/logo_header_invert.png
|
735
739
|
- app/assets/images/pageflow/themes/default/logo_navi.png
|
736
740
|
- app/assets/images/pageflow/themes/default/logo_navi_invert.png
|
737
741
|
- app/assets/images/pageflow/themes/default/logo_print.png
|
@@ -793,10 +797,12 @@ files:
|
|
793
797
|
- app/assets/javascripts/pageflow/editor/models/mixins/transient_references.js
|
794
798
|
- app/assets/javascripts/pageflow/editor/models/other_entry.js
|
795
799
|
- app/assets/javascripts/pageflow/editor/models/page.js
|
800
|
+
- app/assets/javascripts/pageflow/editor/models/quota.js
|
796
801
|
- app/assets/javascripts/pageflow/editor/models/video_file.js
|
797
802
|
- app/assets/javascripts/pageflow/editor/renderer.js
|
798
803
|
- app/assets/javascripts/pageflow/editor/routers/sidebar_router.js
|
799
804
|
- app/assets/javascripts/pageflow/editor/sync.js
|
805
|
+
- app/assets/javascripts/pageflow/editor/templates/back_button_decorator.jst.ejs
|
800
806
|
- app/assets/javascripts/pageflow/editor/templates/chapter_item.jst.ejs
|
801
807
|
- app/assets/javascripts/pageflow/editor/templates/edit_chapter.jst.ejs
|
802
808
|
- app/assets/javascripts/pageflow/editor/templates/edit_entry.jst.ejs
|
@@ -832,9 +838,11 @@ files:
|
|
832
838
|
- app/assets/javascripts/pageflow/editor/templates/other_entry_item.jst.ejs
|
833
839
|
- app/assets/javascripts/pageflow/editor/templates/page_item.jst.ejs
|
834
840
|
- app/assets/javascripts/pageflow/editor/templates/publish_entry.jst.ejs
|
841
|
+
- app/assets/javascripts/pageflow/editor/templates/quota_decorator.jst.ejs
|
835
842
|
- app/assets/javascripts/pageflow/editor/templates/select_button.jst.ejs
|
836
843
|
- app/assets/javascripts/pageflow/editor/templates/tabs_view.jst.ejs
|
837
844
|
- app/assets/javascripts/pageflow/editor/views/audio_file_item_view.js
|
845
|
+
- app/assets/javascripts/pageflow/editor/views/back_button_decorator_view.js
|
838
846
|
- app/assets/javascripts/pageflow/editor/views/chapter_item_view.js
|
839
847
|
- app/assets/javascripts/pageflow/editor/views/collection_view.js
|
840
848
|
- app/assets/javascripts/pageflow/editor/views/configuration_editor_tab_view.js
|
@@ -891,6 +899,7 @@ files:
|
|
891
899
|
- app/assets/javascripts/pageflow/editor/views/page_preview_view.js
|
892
900
|
- app/assets/javascripts/pageflow/editor/views/page_thumbnail_view.js
|
893
901
|
- app/assets/javascripts/pageflow/editor/views/publish_entry_view.js
|
902
|
+
- app/assets/javascripts/pageflow/editor/views/quota_decorator_view.js
|
894
903
|
- app/assets/javascripts/pageflow/editor/views/select_button_view.js
|
895
904
|
- app/assets/javascripts/pageflow/editor/views/sortable_collection_view.js
|
896
905
|
- app/assets/javascripts/pageflow/editor/views/tabs_view.js
|
@@ -954,6 +963,7 @@ files:
|
|
954
963
|
- app/assets/stylesheets/pageflow/admin/entries.css.scss
|
955
964
|
- app/assets/stylesheets/pageflow/admin/entries/folders.css.scss
|
956
965
|
- app/assets/stylesheets/pageflow/admin/entries/user_badge_list.css.scss
|
966
|
+
- app/assets/stylesheets/pageflow/admin/quotas.css.scss
|
957
967
|
- app/assets/stylesheets/pageflow/animations.css.scss
|
958
968
|
- app/assets/stylesheets/pageflow/animations/blink.css.scss
|
959
969
|
- app/assets/stylesheets/pageflow/animations/bounce.css.scss
|
@@ -981,6 +991,7 @@ files:
|
|
981
991
|
- app/assets/stylesheets/pageflow/editor/other_entry_item.css.scss
|
982
992
|
- app/assets/stylesheets/pageflow/editor/outline.css.scss
|
983
993
|
- app/assets/stylesheets/pageflow/editor/publish_entry.css.scss
|
994
|
+
- app/assets/stylesheets/pageflow/editor/quotas.css.scss
|
984
995
|
- app/assets/stylesheets/pageflow/editor/select_button.css.scss
|
985
996
|
- app/assets/stylesheets/pageflow/editor/tabs_view.css.scss
|
986
997
|
- app/assets/stylesheets/pageflow/editor/wysihtml5.css.scss
|
@@ -1028,6 +1039,7 @@ files:
|
|
1028
1039
|
- app/assets/stylesheets/pageflow/themes/default/page.css.scss
|
1029
1040
|
- app/assets/stylesheets/pageflow/video_player.css.scss
|
1030
1041
|
- app/controllers/concerns/pageflow/edit_locking.rb
|
1042
|
+
- app/controllers/concerns/pageflow/quota_verification.rb
|
1031
1043
|
- app/controllers/pageflow/application_controller.rb
|
1032
1044
|
- app/controllers/pageflow/chapters_controller.rb
|
1033
1045
|
- app/controllers/pageflow/edit_locks_controller.rb
|
@@ -1036,6 +1048,7 @@ files:
|
|
1036
1048
|
- app/controllers/pageflow/editor/file_usages_controller.rb
|
1037
1049
|
- app/controllers/pageflow/editor/files_controller.rb
|
1038
1050
|
- app/controllers/pageflow/editor/image_files_controller.rb
|
1051
|
+
- app/controllers/pageflow/editor/quotas_controller.rb
|
1039
1052
|
- app/controllers/pageflow/editor/video_files_controller.rb
|
1040
1053
|
- app/controllers/pageflow/entries_controller.rb
|
1041
1054
|
- app/controllers/pageflow/pages_controller.rb
|
@@ -1051,6 +1064,7 @@ files:
|
|
1051
1064
|
- app/helpers/pageflow/media_query_helper.rb
|
1052
1065
|
- app/helpers/pageflow/page_types_helper.rb
|
1053
1066
|
- app/helpers/pageflow/pages_helper.rb
|
1067
|
+
- app/helpers/pageflow/quota_helper.rb
|
1054
1068
|
- app/helpers/pageflow/render_json_helper.rb
|
1055
1069
|
- app/helpers/pageflow/stub_page_configuration.rb
|
1056
1070
|
- app/helpers/pageflow/users_helper.rb
|
@@ -1088,6 +1102,8 @@ files:
|
|
1088
1102
|
- app/views/admin/entries/_revisions.html.arb
|
1089
1103
|
- app/views/admin/memberships/_form.html.erb
|
1090
1104
|
- app/views/admin/revisions/_form.html.erb
|
1105
|
+
- app/views/admin/users/_form.html.erb
|
1106
|
+
- app/views/admin/users/_quota_exceeded.html.erb
|
1091
1107
|
- app/views/admin/users/delete_me.html.erb
|
1092
1108
|
- app/views/admin/users/me.html.erb
|
1093
1109
|
- app/views/components/pageflow/admin/custom_scopes_renderer.rb
|
@@ -1107,6 +1123,8 @@ files:
|
|
1107
1123
|
- app/views/pageflow/editor/files/create.json.jbuilder
|
1108
1124
|
- app/views/pageflow/editor/files/index.json.jbuilder
|
1109
1125
|
- app/views/pageflow/editor/image_files/_image_file.json.jbuilder
|
1126
|
+
- app/views/pageflow/editor/quotas/_published_entries_exceeded.html.erb
|
1127
|
+
- app/views/pageflow/editor/quotas/show.json.jbuilder
|
1110
1128
|
- app/views/pageflow/editor/video_files/_video_file.json.jbuilder
|
1111
1129
|
- app/views/pageflow/entries/_analytics.html.erb
|
1112
1130
|
- app/views/pageflow/entries/_entry.html.erb
|
@@ -1161,11 +1179,14 @@ files:
|
|
1161
1179
|
- config/locales/devise.en.yml
|
1162
1180
|
- config/locales/edit_locks.de.yml
|
1163
1181
|
- config/locales/editor.de.yml
|
1182
|
+
- config/locales/editor/quotas.de.yml
|
1164
1183
|
- config/locales/en.yml
|
1165
1184
|
- config/locales/formtastic.de.yml
|
1166
1185
|
- config/locales/pageflow/user_mailer.yml
|
1186
|
+
- config/locales/quotas.de.yml
|
1167
1187
|
- config/locales/rails.de.yml
|
1168
1188
|
- config/routes.rb
|
1189
|
+
- config/spring.rb
|
1169
1190
|
- db/migrate/20140418225525_setup_schema.rb
|
1170
1191
|
- db/migrate/20140418240000_add_attributes_to_users.rb
|
1171
1192
|
- lib/active_admin/patches/views/attributes_table.rb
|
@@ -1183,6 +1204,7 @@ files:
|
|
1183
1204
|
- lib/generators/pageflow/install/install_generator.rb
|
1184
1205
|
- lib/generators/pageflow/resque/resque_generator.rb
|
1185
1206
|
- lib/generators/pageflow/resque/templates/devise_async.rb
|
1207
|
+
- lib/generators/pageflow/resque/templates/resque.rake
|
1186
1208
|
- lib/generators/pageflow/resque/templates/resque.rb
|
1187
1209
|
- lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
|
1188
1210
|
- lib/generators/pageflow/resque/templates/resque_logger.rb
|
@@ -1195,7 +1217,9 @@ files:
|
|
1195
1217
|
- lib/pageflow/built_in_page_type.rb
|
1196
1218
|
- lib/pageflow/configuration.rb
|
1197
1219
|
- lib/pageflow/engine.rb
|
1220
|
+
- lib/pageflow/hooks.rb
|
1198
1221
|
- lib/pageflow/page_type.rb
|
1222
|
+
- lib/pageflow/quota.rb
|
1199
1223
|
- lib/pageflow/seeds.rb
|
1200
1224
|
- lib/pageflow/user_mixin.rb
|
1201
1225
|
- lib/pageflow/version.rb
|