pageflow 0.3.0 → 0.4.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.

Files changed (54) hide show
  1. checksums.yaml +8 -8
  2. data/admins/pageflow/membership.rb +1 -2
  3. data/admins/pageflow/user.rb +1 -1
  4. data/app/assets/javascripts/pageflow/editor/base.js +1 -0
  5. data/app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js +36 -0
  6. data/app/assets/javascripts/pageflow/editor/collections/mixins/files_collection.js +2 -1
  7. data/app/assets/javascripts/pageflow/editor/collections/mixins/ordered_collection.js +17 -0
  8. data/app/assets/javascripts/pageflow/editor/collections/subset_collection.js +0 -2
  9. data/app/assets/javascripts/pageflow/editor/controllers/sidebar_controller.js +5 -2
  10. data/app/assets/javascripts/pageflow/editor/models/chapter.js +3 -25
  11. data/app/assets/javascripts/pageflow/editor/models/encoding_confirmation.js +40 -6
  12. data/app/assets/javascripts/pageflow/editor/models/page.js +7 -5
  13. data/app/assets/javascripts/pageflow/editor/routers/sidebar_router.js +1 -0
  14. data/app/assets/javascripts/pageflow/editor/templates/blank_entry.jst.ejs +8 -0
  15. data/app/assets/javascripts/pageflow/editor/templates/confirm_encoding.jst.ejs +8 -2
  16. data/app/assets/javascripts/pageflow/editor/templates/file_item.jst.ejs +1 -0
  17. data/app/assets/javascripts/pageflow/editor/templates/publish_entry.jst.ejs +6 -0
  18. data/app/assets/javascripts/pageflow/editor/views/blank_entry_view.js +4 -0
  19. data/app/assets/javascripts/pageflow/editor/views/confirm_encoding_view.js +10 -4
  20. data/app/assets/javascripts/pageflow/editor/views/confirmable_file_item_view.js +1 -0
  21. data/app/assets/javascripts/pageflow/editor/views/entry_preview_view.js +2 -1
  22. data/app/assets/javascripts/pageflow/editor/views/file_item_view.js +8 -0
  23. data/app/assets/javascripts/pageflow/editor/views/publish_entry_view.js +5 -1
  24. data/app/assets/javascripts/pageflow/editor/views/sortable_collection_view.js +8 -4
  25. data/app/assets/stylesheets/pageflow/editor/base.css.scss +2 -1
  26. data/app/assets/stylesheets/pageflow/editor/blank_entry.css.scss +46 -0
  27. data/app/assets/stylesheets/pageflow/editor/confirm_encoding.css.scss +84 -0
  28. data/app/assets/stylesheets/pageflow/editor/dialogs.css.scss +1 -1
  29. data/app/assets/stylesheets/pageflow/editor/files.css.scss +5 -0
  30. data/app/assets/stylesheets/pageflow/editor/publish_entry.css.scss +15 -0
  31. data/app/assets/stylesheets/pageflow/navigation_bar.css.scss +5 -5
  32. data/app/assets/stylesheets/pageflow/player_controls.css.scss +2 -6
  33. data/app/assets/stylesheets/pageflow/themes/default/anchors.css.scss +2 -2
  34. data/app/assets/stylesheets/pageflow/themes/default/page.css.scss +1 -0
  35. data/app/controllers/pageflow/application_controller.rb +4 -0
  36. data/app/controllers/pageflow/editor/encoding_confirmations_controller.rb +1 -1
  37. data/app/helpers/pageflow/admin/memberships_helper.rb +52 -0
  38. data/app/helpers/pageflow/admin/users_helper.rb +9 -0
  39. data/app/helpers/pageflow/entries_helper.rb +26 -10
  40. data/app/models/pageflow/entry.rb +1 -0
  41. data/app/views/admin/memberships/_form.html.erb +2 -2
  42. data/app/views/pageflow/editor/entries/_entry.json.jbuilder +2 -0
  43. data/app/views/pageflow/editor/entry_publications/check.json.jbuilder +1 -0
  44. data/app/views/pageflow/entries/_navigation.html.erb +1 -7
  45. data/app/views/pageflow/entries/_social_meta_tags.html.erb +1 -1
  46. data/app/views/pageflow/entries/navigation/_bar_top.html.erb +1 -9
  47. data/app/views/pageflow/entries/navigation/_credits_box_content.html.erb +5 -0
  48. data/config/locales/editor/blank_entry.yml +9 -0
  49. data/lib/pageflow/user_mixin.rb +4 -0
  50. data/lib/pageflow/version.rb +1 -1
  51. metadata +658 -652
  52. data/app/assets/stylesheets/pageflow/editor/confirmable_files.css.scss +0 -67
  53. data/app/helpers/pageflow/application_helper.rb +0 -4
  54. data/app/helpers/pageflow/users_helper.rb +0 -15
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2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MWQxNTcxZWMwYzIwOTc0OWI2
15
+ N2Q1OWVhYTc3ZmQ0MmYwODQ0M2QxZDU3ZTc1NTc3ZDdmZTcwOGU=
@@ -10,8 +10,7 @@ module Pageflow
10
10
  belongs_to :entry, :parent_class => Pageflow::Entry, :polymorphic => true
11
11
  belongs_to :user, :parent_class => User, :polymorphic => true
12
12
 
13
- helper Pageflow::UsersHelper
14
- helper Pageflow::EntriesHelper
13
+ helper Pageflow::Admin::MembershipsHelper
15
14
 
16
15
  def permitted_params
17
16
  params.permit(:membership => [:user_id, :entry_id])
@@ -141,7 +141,7 @@ module Pageflow
141
141
  controller do
142
142
  include Pageflow::QuotaVerification
143
143
 
144
- helper Pageflow::UsersHelper
144
+ helper Pageflow::Admin::UsersHelper
145
145
  helper Pageflow::QuotaHelper
146
146
 
147
147
  def build_new_resource
@@ -26,6 +26,7 @@
26
26
  //= require_tree ./models
27
27
  //= require_tree ./collections/mixins
28
28
  //= require ./collections/multi_collection
29
+ //= require ./collections/subset_collection
29
30
  //= require_tree ./collections
30
31
  //= require_tree ./routers
31
32
  //= require_tree ./controllers
@@ -0,0 +1,36 @@
1
+ pageflow.ChapterPagesCollection = pageflow.SubsetCollection.extend({
2
+ mixins: [pageflow.orderedCollection],
3
+
4
+ constructor: function(options) {
5
+ var chapter = options.chapter;
6
+
7
+ pageflow.SubsetCollection.prototype.constructor.call(this, {
8
+ parent: options.pages,
9
+ parentModel: chapter,
10
+
11
+ filter: function(item) {
12
+ return item.get('chapter_id') === chapter.id;
13
+ },
14
+
15
+ comparator: function(item) {
16
+ return item.get('position');
17
+ }
18
+ });
19
+
20
+ this.each(function(page) {
21
+ page.chapter = chapter;
22
+ });
23
+
24
+ this.listenTo(this, 'add', function(model) {
25
+ model.chapter = chapter;
26
+ });
27
+
28
+ this.listenTo(this, 'remove', function(model) {
29
+ model.chapter = null;
30
+ });
31
+
32
+ this.listenTo(chapter, 'destroy', function() {
33
+ this.clear();
34
+ });
35
+ }
36
+ });
@@ -7,7 +7,8 @@ pageflow.filesCollection = {
7
7
  },
8
8
 
9
9
  comparator: function(file) {
10
- return file.get('file_name');
10
+ var fileName = file.get('file_name');
11
+ return fileName.toLowerCase ? fileName.toLowerCase() : fileName;
11
12
  },
12
13
 
13
14
  url: function() {
@@ -1,8 +1,25 @@
1
1
  pageflow.orderedCollection = {
2
+ initialize: function() {
3
+ this.listenTo(this, 'remove', function() {
4
+ this.consolidatePositions();
5
+ this.saveOrder();
6
+ });
7
+ },
8
+
9
+ consolidatePositions: function() {
10
+ this.each(function(item, index) {
11
+ item.set('position', index);
12
+ });
13
+ },
14
+
2
15
  saveOrder: function() {
3
16
  var parentModel = this.parentModel;
4
17
  var collection = this;
5
18
 
19
+ if (collection.isEmpty()) {
20
+ return $.Deferred().resolve().promise();
21
+ }
22
+
6
23
  return Backbone.sync('patch', parentModel, {
7
24
  url: collection.url() + '/order',
8
25
  attrs: {ids: collection.pluck('id')},
@@ -1,6 +1,4 @@
1
1
  pageflow.SubsetCollection = Backbone.Collection.extend({
2
- mixins: [pageflow.orderedCollection],
3
-
4
2
  constructor: function(options) {
5
3
  var adding = false;
6
4
 
@@ -30,9 +30,12 @@ pageflow.SidebarController = Backbone.Marionette.Controller.extend({
30
30
  }));
31
31
  },
32
32
 
33
- confirmableFiles: function() {
33
+ confirmableFiles: function(preselectedFileType, preselectedFileId) {
34
34
  this.region.show(pageflow.ConfirmEncodingView.create({
35
- model: new pageflow.EncodingConfirmation()
35
+ model: pageflow.EncodingConfirmation.createWithPreselection({
36
+ fileType: preselectedFileType,
37
+ fileId: preselectedFileId
38
+ })
36
39
  }));
37
40
  },
38
41
 
@@ -6,37 +6,15 @@ pageflow.Chapter = Backbone.Model.extend({
6
6
  mixins: [pageflow.failureTracking, pageflow.delayedDestroying],
7
7
 
8
8
  initialize: function(attributes, options) {
9
- this.pages = new pageflow.SubsetCollection({
10
- parent: pageflow.pages,
11
- parentModel: this,
12
-
13
- filter: function(item) {
14
- return item.get('chapter_id') === attributes.id;
15
- },
16
-
17
- comparator: function(item) {
18
- return item.get('position');
19
- }
9
+ this.pages = new pageflow.ChapterPagesCollection({
10
+ pages: options.pages || pageflow.pages,
11
+ chapter: this
20
12
  });
21
13
 
22
- this.pages.each(function(page) { page.chapter = this; }, this);
23
-
24
14
  this.listenTo(this, 'change:title', function() {
25
15
  this.save();
26
16
  });
27
17
 
28
- this.listenTo(this.pages, 'add', function(model) {
29
- model.chapter = this;
30
- });
31
-
32
- this.listenTo(this.pages, 'remove', function(model) {
33
- model.chapter = null;
34
- });
35
-
36
- this.listenTo(this, 'destroy', function() {
37
- this.pages.clear();
38
- });
39
-
40
18
  return attributes;
41
19
  },
42
20
 
@@ -5,6 +5,7 @@ pageflow.EncodingConfirmation = Backbone.Model.extend({
5
5
  this.videoFiles = new Backbone.Collection();
6
6
  this.audioFiles = new Backbone.Collection();
7
7
 
8
+ this.updateEmpty();
8
9
  this.watchCollections();
9
10
  },
10
11
 
@@ -12,17 +13,18 @@ pageflow.EncodingConfirmation = Backbone.Model.extend({
12
13
  this.listenTo(this.videoFiles, 'add remove', this.check);
13
14
  this.listenTo(this.audioFiles, 'add remove', this.check);
14
15
 
15
- this.check();
16
+ this.listenTo(this.videoFiles, 'reset', this.updateEmpty);
17
+ this.listenTo(this.audioFiles, 'reset', this.updateEmpty);
16
18
  },
17
19
 
18
20
  check: function() {
19
21
  var model = this;
20
22
 
21
- this.set('empty', this.videoFiles.length === 0 && this.audioFiles.length === 0);
22
- this.set('checking', true);
23
+ model.updateEmpty();
24
+ model.set('checking', true);
23
25
 
24
- this.save({}, {
25
- url: this.url() + '/check',
26
+ model.save({}, {
27
+ url: model.url() + '/check',
26
28
  success: function() {
27
29
  model.set('checking', false);
28
30
  },
@@ -32,6 +34,23 @@ pageflow.EncodingConfirmation = Backbone.Model.extend({
32
34
  });
33
35
  },
34
36
 
37
+ saveAndReset: function() {
38
+ var model = this;
39
+
40
+ model.save({}, {
41
+ success: function() {
42
+ model.set('summary_html', '');
43
+
44
+ model.videoFiles.reset();
45
+ model.audioFiles.reset();
46
+ }
47
+ });
48
+ },
49
+
50
+ updateEmpty: function() {
51
+ this.set('empty', this.videoFiles.length === 0 && this.audioFiles.length === 0);
52
+ },
53
+
35
54
  url: function() {
36
55
  return '/editor/entries/' + pageflow.entry.get('id') + '/encoding_confirmations';
37
56
  },
@@ -42,4 +61,19 @@ pageflow.EncodingConfirmation = Backbone.Model.extend({
42
61
  audio_file_ids: this.audioFiles.pluck('id'),
43
62
  };
44
63
  }
45
- });
64
+ });
65
+
66
+ pageflow.EncodingConfirmation.createWithPreselection = function(options) {
67
+ var model = new pageflow.EncodingConfirmation();
68
+
69
+ if (options.fileId) {
70
+ if (options.fileType === 'video_file') {
71
+ model.videoFiles.add(pageflow.videoFiles.get(options.fileId));
72
+ }
73
+ else {
74
+ model.audioFiles.add(pageflow.audioFiles.get(options.fileId));
75
+ }
76
+ }
77
+
78
+ return model;
79
+ };
@@ -3,11 +3,13 @@ pageflow.Page = Backbone.Model.extend({
3
3
  paramRoot: 'page',
4
4
  i18nKey: 'pageflow/page',
5
5
 
6
- defaults: {
7
- template: 'background_image',
8
- configuration: {},
9
- active: false,
10
- perma_id: ''
6
+ defaults: function() {
7
+ return {
8
+ template: 'background_image',
9
+ configuration: {},
10
+ active: false,
11
+ perma_id: ''
12
+ };
11
13
  },
12
14
 
13
15
  mixins: [pageflow.failureTracking, pageflow.delayedDestroying],
@@ -15,6 +15,7 @@ pageflow.SidebarRouter = Backbone.Marionette.AppRouter.extend({
15
15
  'files?page=:page_id&attribute=:attribute': 'files',
16
16
  'files': 'files',
17
17
 
18
+ 'confirmable_files?type=:type&id=:id': 'confirmableFiles',
18
19
  'confirmable_files': 'confirmableFiles',
19
20
 
20
21
  'meta_data': 'metaData',
@@ -0,0 +1,8 @@
1
+ <h2><%= I18n.t('editor.blank_entry.header') %></h2>
2
+ <p><%= I18n.t('editor.blank_entry.intro') %></p>
3
+ <ol>
4
+ <li><%= I18n.t('editor.blank_entry.create_chapter') %></li>
5
+ <li><%= I18n.t('editor.blank_entry.create_page') %></li>
6
+ <li><%= I18n.t('editor.blank_entry.edit_page') %></li>
7
+ </ol>
8
+ <p><%= I18n.t('editor.blank_entry.outro') %></p>
@@ -1,5 +1,11 @@
1
1
  <div class="blank_slate">
2
- Keine Dateien freizugeben.
2
+ <p>
3
+ Alle Dateien wurden zur Transcodierung freigegeben.
4
+ </p>
5
+ <p>
6
+ Auf der <a href="#/files/video_files">'Dateien verwalten'-Seite</a> wird der Fortschritt
7
+ der Verarbeitung angezeigt.
8
+ </p>
3
9
  </div>
4
10
 
5
11
  <div class="video_files_panel">
@@ -12,4 +18,4 @@
12
18
 
13
19
  <div class="summary">
14
20
  </div>
15
- <button class="confirm_encoding">Ausgewählte Dateien transcodieren</button>
21
+ <button class="confirm">Ausgewählte Dateien transcodieren</button>
@@ -4,6 +4,7 @@
4
4
  <a class="select">Auswählen</a>
5
5
 
6
6
  <div class="actions">
7
+ <a class="confirm" title="Überprüfen und bestätigen"></a>
7
8
  <a class="retry" title="Erneut versuchen"></a>
8
9
  <a class="remove" title="Löschen"></a>
9
10
  <a class="cancel" title="Abbrechen"></a>
@@ -37,3 +37,9 @@
37
37
 
38
38
  <button class="save" disabled>Veröffentlichen</a>
39
39
  </div>
40
+
41
+ <div class="success notice">
42
+ <p>Der Beitrag wurde erfolgreich veröffentlicht.</p>
43
+ <p>Er kann nun unter folgender URL erreicht werden:</p>
44
+ <p><a href="" target="_blank"></a></p>
45
+ </div>
@@ -0,0 +1,4 @@
1
+ pageflow.BlankEntryView = Backbone.Marionette.ItemView.extend({
2
+ template: 'templates/blank_entry',
3
+ className: 'blank_entry'
4
+ });
@@ -1,5 +1,6 @@
1
1
  pageflow.ConfirmEncodingView = Backbone.Marionette.ItemView.extend({
2
2
  template: 'templates/confirm_encoding',
3
+ className: 'confirm_encoding',
3
4
 
4
5
  ui: {
5
6
  blankSlate: '.blank_slate',
@@ -12,7 +13,7 @@ pageflow.ConfirmEncodingView = Backbone.Marionette.ItemView.extend({
12
13
 
13
14
  events: {
14
15
  'click button': function() {
15
- this.model.save();
16
+ this.model.saveAndReset();
16
17
  }
17
18
  },
18
19
 
@@ -22,10 +23,10 @@ pageflow.ConfirmEncodingView = Backbone.Marionette.ItemView.extend({
22
23
  },
23
24
 
24
25
  onRender: function() {
25
- this.listenTo(this.model, 'change:empty change:exceeding change:checking', this.updateSummary);
26
+ this.listenTo(this.model, 'change', this.updateSummary);
26
27
 
27
- this.listenTo(this.confirmableAudioFiles, 'add remove', this.update);
28
- this.listenTo(this.confirmableVideoFiles, 'add remove', this.update);
28
+ this.listenTo(this.confirmableAudioFiles, 'add remove', this.updateBlankSlate);
29
+ this.listenTo(this.confirmableVideoFiles, 'add remove', this.updateBlankSlate);
29
30
 
30
31
  this.ui.videoFilesPanel.append(this.subview(new pageflow.CollectionView({
31
32
  tagName: 'ul',
@@ -51,6 +52,11 @@ pageflow.ConfirmEncodingView = Backbone.Marionette.ItemView.extend({
51
52
  },
52
53
 
53
54
  update: function() {
55
+ this.updateBlankSlate();
56
+ this.updateSummary();
57
+ },
58
+
59
+ updateBlankSlate: function() {
54
60
  this.ui.blankSlate.toggle(!this.confirmableVideoFiles.length && !this.confirmableAudioFiles.length);
55
61
  this.ui.videoFilesPanel.toggle(!!this.confirmableVideoFiles.length);
56
62
  this.ui.audioFilesPanel.toggle(!!this.confirmableAudioFiles.length);
@@ -20,6 +20,7 @@ pageflow.ConfirmableFileItemView = Backbone.Marionette.ItemView.extend({
20
20
  onRender: function() {
21
21
  this.ui.label.attr('for', this.cid);
22
22
  this.ui.checkBox.attr('id', this.cid);
23
+ this.ui.checkBox.prop('checked', this.options.selectedFiles.contains(this.model));
23
24
 
24
25
  this.ui.fileName.text(this.model.get('file_name') || '(Unbekannt)');
25
26
  this.ui.duration.text(this.model.get('duration') || '-');
@@ -14,7 +14,8 @@ pageflow.EntryPreviewView = Backbone.Marionette.ItemView.extend({
14
14
  this.pageViews = this.subview(new pageflow.CollectionView({
15
15
  el: this.ui.entry,
16
16
  collection: this.model.pages,
17
- itemViewConstructor: pageflow.PagePreviewView
17
+ itemViewConstructor: pageflow.PagePreviewView,
18
+ blankSlateViewConstructor: pageflow.BlankEntryView
18
19
  }));
19
20
 
20
21
  this.ui.entry.append($('<div class="scroll_indicator indicator">Scrollen, um weiterzulesen</div>'));
@@ -9,6 +9,7 @@ pageflow.FileItemView = Backbone.Marionette.ItemView.extend({
9
9
 
10
10
  selectButton: '.select',
11
11
  removeButton: '.remove',
12
+ confirmButton: '.confirm',
12
13
  cancelButton: '.cancel',
13
14
  retryButton: '.retry',
14
15
 
@@ -30,6 +31,8 @@ pageflow.FileItemView = Backbone.Marionette.ItemView.extend({
30
31
 
31
32
  'click .cancel': 'cancel',
32
33
 
34
+ 'click .confirm': 'confirm',
35
+
33
36
  'click .remove': 'destroy',
34
37
 
35
38
  'click .retry': 'retry',
@@ -75,6 +78,7 @@ pageflow.FileItemView = Backbone.Marionette.ItemView.extend({
75
78
  this.ui.selectButton.toggle(!!this.options.selectionHandler);
76
79
 
77
80
  this.ui.cancelButton.toggle(this.model.isUploading());
81
+ this.ui.confirmButton.toggle(this.model.isConfirmable());
78
82
  this.ui.removeButton.toggle(!this.model.isUploading());
79
83
  this.ui.retryButton.toggle(this.model.isRetryable());
80
84
 
@@ -110,6 +114,10 @@ pageflow.FileItemView = Backbone.Marionette.ItemView.extend({
110
114
  this.model.cancelUpload();
111
115
  },
112
116
 
117
+ confirm: function() {
118
+ pageflow.editor.navigate('/confirmable_files?type=' + this.model.modelName + '&id=' + this.model.id, {trigger: true});
119
+ },
120
+
113
121
  retry: function() {
114
122
  this.model.retry();
115
123
  }