pageflow-external-links 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +19 -0
  3. data/.jshintignore +1 -0
  4. data/.jshintrc +22 -0
  5. data/Gemfile +10 -0
  6. data/README.md +49 -0
  7. data/Rakefile +7 -0
  8. data/app/assets/images/pageflow/external_links_pictogram.png +0 -0
  9. data/app/assets/images/pageflow/external_links_pictogram_small.png +0 -0
  10. data/app/assets/images/pageflow/ov-external_links.png +0 -0
  11. data/app/assets/javascript/pageflow/external_links.js +4 -0
  12. data/app/assets/javascript/pageflow/external_links/editor.js +12 -0
  13. data/app/assets/javascript/pageflow/external_links/editor/collections/site_references_collection.js +11 -0
  14. data/app/assets/javascript/pageflow/external_links/editor/collections/sites_collection.js +22 -0
  15. data/app/assets/javascript/pageflow/external_links/editor/config.js +17 -0
  16. data/app/assets/javascript/pageflow/external_links/editor/controllers/sidebar_controller.js +34 -0
  17. data/app/assets/javascript/pageflow/external_links/editor/models/configuration_mixin.js +38 -0
  18. data/app/assets/javascript/pageflow/external_links/editor/models/site.js +25 -0
  19. data/app/assets/javascript/pageflow/external_links/editor/models/site_file_selection_handler.js +13 -0
  20. data/app/assets/javascript/pageflow/external_links/editor/models/site_reference.js +7 -0
  21. data/app/assets/javascript/pageflow/external_links/editor/models/site_selection_handler.js +7 -0
  22. data/app/assets/javascript/pageflow/external_links/editor/routers/sidebar_router.js +8 -0
  23. data/app/assets/javascript/pageflow/external_links/editor/templates/edit_site.jst.ejs +10 -0
  24. data/app/assets/javascript/pageflow/external_links/editor/templates/embedded/list_item.jst.ejs +5 -0
  25. data/app/assets/javascript/pageflow/external_links/editor/templates/inputs/site_reference.jst.ejs +7 -0
  26. data/app/assets/javascript/pageflow/external_links/editor/templates/site_item.jst.ejs +6 -0
  27. data/app/assets/javascript/pageflow/external_links/editor/templates/site_reference_item.jst.ejs +6 -0
  28. data/app/assets/javascript/pageflow/external_links/editor/templates/sites.jst.ejs +1 -0
  29. data/app/assets/javascript/pageflow/external_links/editor/templates/sites_blank_slate.jst.ejs +1 -0
  30. data/app/assets/javascript/pageflow/external_links/editor/views/configuration_editor.js +23 -0
  31. data/app/assets/javascript/pageflow/external_links/editor/views/edit_site_view.js +69 -0
  32. data/app/assets/javascript/pageflow/external_links/editor/views/embedded/list_embedded_view.js +22 -0
  33. data/app/assets/javascript/pageflow/external_links/editor/views/embedded/list_item_embedded_view.js +56 -0
  34. data/app/assets/javascript/pageflow/external_links/editor/views/inputs/site_reference_input_view.js +31 -0
  35. data/app/assets/javascript/pageflow/external_links/editor/views/site_item_view.js +44 -0
  36. data/app/assets/javascript/pageflow/external_links/editor/views/site_reference_item_view.js +32 -0
  37. data/app/assets/javascript/pageflow/external_links/editor/views/sites_view.js +35 -0
  38. data/app/assets/javascript/pageflow/external_links/page_type.js +141 -0
  39. data/app/assets/stylesheets/pageflow/external_links.css.scss +175 -0
  40. data/app/assets/stylesheets/pageflow/external_links/editor.css.scss +97 -0
  41. data/app/controllers/pageflow/external_links/sites_controller.rb +40 -0
  42. data/app/helpers/pageflow/external_links/sites_helper.rb +9 -0
  43. data/app/models/pageflow/external_links/site.rb +7 -0
  44. data/app/views/pageflow/external_links/page.html +34 -0
  45. data/app/views/pageflow/external_links/sites/_site.html.erb +10 -0
  46. data/config/locales/de.yml +21 -0
  47. data/config/routes.rb +5 -0
  48. data/db/migrate/20140616153235_create_pageflow_external_links_sites.rb +16 -0
  49. data/lib/pageflow-external-links.rb +6 -0
  50. data/lib/pageflow/external_links/engine.rb +18 -0
  51. data/lib/pageflow/external_links/page_type.rb +15 -0
  52. data/pageflow-external-links.gemspec +27 -0
  53. metadata +193 -0
@@ -0,0 +1,97 @@
1
+ .editor {
2
+ .manage_external_sites {
3
+ a.add {
4
+ @include plus-circled-icon;
5
+ @include icon-button;
6
+ position: absolute;
7
+ top: 0;
8
+ right: 0;
9
+ }
10
+
11
+ ul.sites {
12
+ margin-top: 10px;
13
+ }
14
+
15
+ ul.sites > li {
16
+ @include right-open-icon;
17
+ @include background-icon-right($color: #888, $top: 20px);
18
+
19
+ background-color: #fff;
20
+ margin-bottom: 2px;
21
+ padding: 37px 10px 0 70px;
22
+ white-space: nowrap;
23
+ overflow: hidden;
24
+ height: 23px;
25
+ }
26
+
27
+ .thumbnail {
28
+ position: absolute;
29
+ top: 0;
30
+ left: 0;
31
+ height: 60px;
32
+ width: 60px;
33
+ vertical-align: middle;
34
+ background-size: cover;
35
+ background-color: #444;
36
+ }
37
+
38
+ a.select {
39
+ @include button(#590);
40
+
41
+ padding-left: 5px;
42
+ padding-right: 5px;
43
+ vertical-align: middle;
44
+
45
+ position: absolute;
46
+ top: 3px;
47
+ left: 70px;
48
+ }
49
+ }
50
+
51
+ .external_links_site_reference_input {
52
+ .add_reference {
53
+ @include plus-circled-icon;
54
+ @include icon-button;
55
+ }
56
+
57
+ ul.sites {
58
+ margin-bottom: 10px;
59
+ }
60
+
61
+ a.remove {
62
+ @include icon-only-button(#aaa);
63
+ @include trash-icon;
64
+ position: absolute;
65
+ right: 4px;
66
+ top: 4px;
67
+ }
68
+
69
+ a.edit {
70
+ @include icon-only-button(#aaa);
71
+ @include pencil-icon;
72
+ position: absolute;
73
+ right: 40px;
74
+ top: 4px;
75
+ }
76
+
77
+ .external_links_site_reference {
78
+ margin-bottom: 2px;
79
+
80
+ > a:first-child {
81
+ padding-left: 45px;
82
+ cursor: default;
83
+ }
84
+
85
+ .thumbnail {
86
+ position: absolute;
87
+ top: 0;
88
+ left: 0;
89
+ height: 35px;
90
+ width: 35px;
91
+ cursor: move;
92
+ background-size: cover;
93
+ background-color: #444;
94
+ }
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,40 @@
1
+ module Pageflow
2
+ module ExternalLinks
3
+ class SitesController < ActionController::Base
4
+ respond_to :json
5
+
6
+ def index
7
+ @entry = Entry.find(params[:entry_id])
8
+
9
+ respond_with(Site.all_for_revision(@entry.draft))
10
+ end
11
+
12
+ def create
13
+ @entry = Entry.find(params[:entry_id])
14
+ site = Site.all_for_revision(@entry.draft).create!(site_params)
15
+
16
+ respond_with(site)
17
+ end
18
+
19
+ def update
20
+ site = Site.find(params[:id])
21
+ site.update(site_params)
22
+
23
+ respond_with(site)
24
+ end
25
+
26
+ def destroy
27
+ site = Site.find(params[:id])
28
+ site.destroy
29
+
30
+ respond_with(site)
31
+ end
32
+
33
+ protected
34
+
35
+ def site_params
36
+ params.require(:site).permit(:url, :thumbnail, :title, :description, :open_in_new_tab)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,9 @@
1
+ module Pageflow
2
+ module ExternalLinks
3
+ module SitesHelper
4
+ def external_links_site_css_class(site)
5
+ ['link-item', site.title.blank? && site.description.blank? ? 'no_text' : ''].compact.join(' ')
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Pageflow
2
+ module ExternalLinks
3
+ class Site < ActiveRecord::Base
4
+ include RevisionComponent
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,34 @@
1
+ <div class="blackLayer"></div>
2
+ <div class="content_and_background external-links-page">
3
+ <div class="backgroundArea">
4
+ <%= background_image_div(configuration, 'background_image') %>
5
+ <%= shadow_div :opacity => configuration['gradient_opacity'] %>
6
+ </div>
7
+
8
+ <div class="content">
9
+ <div class="scroller">
10
+ <div>
11
+ <div class="contentWrapper">
12
+ <div class="page_header">
13
+ <h2>
14
+ <span class="tagline"><%= configuration['tagline'] %></span>
15
+ <span class="title"><%= configuration['title'] %></span>
16
+ <span class="subtitle"><%= configuration['subtitle'] %></span>
17
+ </h2>
18
+ <%= background_image_tag(configuration['background_image_id'], {"class" => "print_image"}) %>
19
+ </div>
20
+ <div class="contentText">
21
+ <p><%= raw configuration['text'] %></p>
22
+ </div>
23
+ <div class="ext-links" id="ext-links">
24
+ <div id="horizontal_scroller">
25
+ <%= render Pageflow::ExternalLinks::Site.from_perma_ids(@entry.try(:revision), configuration['linked_external_site_perma_ids']) %>
26
+ </div>
27
+ </div>
28
+ <a href="#" class="arrow-forward"><span class="hint">Vorwärts</span></a>
29
+ <a href="#" class="arrow-back"><span class="hint">Zurück</span></a>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </div>
@@ -0,0 +1,10 @@
1
+ <%= link_to(site.url,
2
+ class: external_links_site_css_class(site),
3
+ target: site.open_in_new_tab? ? '_blank' : nil) do %>
4
+
5
+ <div class="link-thumbnail image_file_link_thumbnail_large_<%= site.thumbnail %>"></div>
6
+ <div class="link-details">
7
+ <p class="link-title"><%= site.title %></p>
8
+ <p class="link-description"><%= raw(site.description) %></p>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,21 @@
1
+ de:
2
+ pageflow:
3
+ external_links:
4
+ page_type_name: "Externe-Verweise"
5
+ manage_sites: "Externe Verweise verwalten"
6
+ editor:
7
+ inline_help:
8
+ site:
9
+ description: "Empfohlene Textlänge: bis zu 220 Zeichen"
10
+ activerecord:
11
+ attributes:
12
+ site:
13
+ url: "Ziel URL"
14
+ open_in_new_tab: "In neuem Tab öffnen"
15
+ title: "Titel"
16
+ description: "Beschreibung"
17
+ thumbnail: "Thumbnail"
18
+ page:
19
+ linked_external_site_perma_ids: "Externe Seiten"
20
+ "pageflow/page":
21
+ linked_external_site_perma_ids: "Externe Seiten"
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ Pageflow::ExternalLinks::Engine.routes.draw do
2
+ resources :entries, only: [], shallow: true do
3
+ resources :sites
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ class CreatePageflowExternalLinksSites < ActiveRecord::Migration
2
+ def change
3
+ create_table :pageflow_external_links_sites do |t|
4
+ t.integer :perma_id
5
+ t.belongs_to :revision, index: true
6
+
7
+ t.string :url
8
+ t.string :title
9
+ t.string :thumbnail
10
+ t.text :description
11
+ t.boolean :open_in_new_tab
12
+
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,6 @@
1
+ require 'pageflow/external_links/engine'
2
+
3
+ module Pageflow
4
+ module ExternalLinks
5
+ end
6
+ end
@@ -0,0 +1,18 @@
1
+ module Pageflow
2
+ module ExternalLinks
3
+ class Engine < Rails::Engine
4
+ isolate_namespace Pageflow::ExternalLinks
5
+
6
+ config.autoload_paths << File.join(config.root, 'lib')
7
+
8
+ config.generators do |g|
9
+ g.test_framework :rspec,:fixture => false
10
+ g.fixture_replacement :factory_girl, :dir => 'spec/factories'
11
+ g.assets false
12
+ g.helper false
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+
@@ -0,0 +1,15 @@
1
+ module Pageflow
2
+ module ExternalLinks
3
+ class PageType < Pageflow::PageType
4
+ name 'external_links'
5
+
6
+ def revision_components
7
+ [Site]
8
+ end
9
+
10
+ def view_helpers
11
+ [SitesHelper]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "pageflow-external-links"
5
+ spec.version = "0.0.1"
6
+ spec.authors = ["Tim Fischbach"]
7
+ spec.email = ["tfischbach@codevise.de"]
8
+ spec.summary = "Pageflow Page Type for links to external sites"
9
+ spec.homepage = ""
10
+ spec.license = "MIT"
11
+
12
+ spec.files = `git ls-files`.split($/)
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_runtime_dependency "pageflow"
18
+
19
+ # Using translations from rails locales in javascript code.
20
+ spec.add_runtime_dependency 'i18n-js'
21
+
22
+ spec.add_development_dependency "bundler"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec-rails", "~> 2.0"
25
+ spec.add_development_dependency 'factory_girl_rails'
26
+ spec.add_development_dependency "sqlite3"
27
+ end
metadata ADDED
@@ -0,0 +1,193 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pageflow-external-links
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tim Fischbach
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pageflow
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: i18n-js
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: factory_girl_rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description:
112
+ email:
113
+ - tfischbach@codevise.de
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .jshintignore
120
+ - .jshintrc
121
+ - Gemfile
122
+ - README.md
123
+ - Rakefile
124
+ - app/assets/images/pageflow/external_links_pictogram.png
125
+ - app/assets/images/pageflow/external_links_pictogram_small.png
126
+ - app/assets/images/pageflow/ov-external_links.png
127
+ - app/assets/javascript/pageflow/external_links.js
128
+ - app/assets/javascript/pageflow/external_links/editor.js
129
+ - app/assets/javascript/pageflow/external_links/editor/collections/site_references_collection.js
130
+ - app/assets/javascript/pageflow/external_links/editor/collections/sites_collection.js
131
+ - app/assets/javascript/pageflow/external_links/editor/config.js
132
+ - app/assets/javascript/pageflow/external_links/editor/controllers/sidebar_controller.js
133
+ - app/assets/javascript/pageflow/external_links/editor/models/configuration_mixin.js
134
+ - app/assets/javascript/pageflow/external_links/editor/models/site.js
135
+ - app/assets/javascript/pageflow/external_links/editor/models/site_file_selection_handler.js
136
+ - app/assets/javascript/pageflow/external_links/editor/models/site_reference.js
137
+ - app/assets/javascript/pageflow/external_links/editor/models/site_selection_handler.js
138
+ - app/assets/javascript/pageflow/external_links/editor/routers/sidebar_router.js
139
+ - app/assets/javascript/pageflow/external_links/editor/templates/edit_site.jst.ejs
140
+ - app/assets/javascript/pageflow/external_links/editor/templates/embedded/list_item.jst.ejs
141
+ - app/assets/javascript/pageflow/external_links/editor/templates/inputs/site_reference.jst.ejs
142
+ - app/assets/javascript/pageflow/external_links/editor/templates/site_item.jst.ejs
143
+ - app/assets/javascript/pageflow/external_links/editor/templates/site_reference_item.jst.ejs
144
+ - app/assets/javascript/pageflow/external_links/editor/templates/sites.jst.ejs
145
+ - app/assets/javascript/pageflow/external_links/editor/templates/sites_blank_slate.jst.ejs
146
+ - app/assets/javascript/pageflow/external_links/editor/views/configuration_editor.js
147
+ - app/assets/javascript/pageflow/external_links/editor/views/edit_site_view.js
148
+ - app/assets/javascript/pageflow/external_links/editor/views/embedded/list_embedded_view.js
149
+ - app/assets/javascript/pageflow/external_links/editor/views/embedded/list_item_embedded_view.js
150
+ - app/assets/javascript/pageflow/external_links/editor/views/inputs/site_reference_input_view.js
151
+ - app/assets/javascript/pageflow/external_links/editor/views/site_item_view.js
152
+ - app/assets/javascript/pageflow/external_links/editor/views/site_reference_item_view.js
153
+ - app/assets/javascript/pageflow/external_links/editor/views/sites_view.js
154
+ - app/assets/javascript/pageflow/external_links/page_type.js
155
+ - app/assets/stylesheets/pageflow/external_links.css.scss
156
+ - app/assets/stylesheets/pageflow/external_links/editor.css.scss
157
+ - app/controllers/pageflow/external_links/sites_controller.rb
158
+ - app/helpers/pageflow/external_links/sites_helper.rb
159
+ - app/models/pageflow/external_links/site.rb
160
+ - app/views/pageflow/external_links/page.html
161
+ - app/views/pageflow/external_links/sites/_site.html.erb
162
+ - config/locales/de.yml
163
+ - config/routes.rb
164
+ - db/migrate/20140616153235_create_pageflow_external_links_sites.rb
165
+ - lib/pageflow-external-links.rb
166
+ - lib/pageflow/external_links/engine.rb
167
+ - lib/pageflow/external_links/page_type.rb
168
+ - pageflow-external-links.gemspec
169
+ homepage: ''
170
+ licenses:
171
+ - MIT
172
+ metadata: {}
173
+ post_install_message:
174
+ rdoc_options: []
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ requirements: []
188
+ rubyforge_project:
189
+ rubygems_version: 2.2.2
190
+ signing_key:
191
+ specification_version: 4
192
+ summary: Pageflow Page Type for links to external sites
193
+ test_files: []