scrivito_resourcebrowser 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_tree .
12
+ */
@@ -0,0 +1,36 @@
1
+ module ScrivitoResourcebrowser
2
+ class ResourcebrowserController < ApplicationController
3
+ # Return JSON responses without layout information.
4
+ layout false
5
+
6
+ # Renders the resource browser modal and returns it in a JSON response.
7
+ def modal
8
+ render json: { content: render_to_string }
9
+ end
10
+
11
+ # Render a JSON response that holds the resource browser inspector markup. The inspector either
12
+ # renders the details view for the selected object, or a fallback view that is located under
13
+ # 'app/views/obj/details'.
14
+ def inspector
15
+ @obj = Obj.find(params[:id])
16
+
17
+ options = {
18
+ layout: 'scrivito_resourcebrowser/inspector',
19
+ }
20
+
21
+ content = begin
22
+ render_to_string(details_view_template(@obj), options)
23
+ rescue ActionView::MissingTemplate
24
+ render_to_string('scrivito_resourcebrowser/obj/details', options)
25
+ end
26
+
27
+ render json: { content: content }
28
+ end
29
+
30
+ private
31
+
32
+ def details_view_template(obj)
33
+ "#{obj.obj_class_name.underscore}/details"
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,11 @@
1
+ <h3>
2
+ <span class="editing-icon editing-icon-eye" title="Details"></span>
3
+
4
+ <span class="title">
5
+ <%= @obj.name %>
6
+ </span>
7
+ </h3>
8
+
9
+ <div class="inspector-content">
10
+ <%= yield %>
11
+ </div>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>ScrivitoResourcebrowser</title>
5
+ <%= stylesheet_link_tag "scrivito_resourcebrowser/application", media: "all" %>
6
+ <%= javascript_include_tag "scrivito_resourcebrowser/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,7 @@
1
+ <div class="details-view">
2
+ <p class="no-editing-available">
3
+ <span class="editing-icon editing-icon-generic"></span>
4
+
5
+ No edit view available.
6
+ </p>
7
+ </div>
@@ -0,0 +1,16 @@
1
+ <div class="editing-resourcebrowser-footer">
2
+ <a class="editing-button resourcebrowser-close">
3
+ Cancel
4
+ </a>
5
+
6
+ <a class="editing-button editing-green resourcebrowser-save">
7
+ Select
8
+
9
+ <span class="editing-resourcebrowser-counter selected-total"></span>
10
+ </a>
11
+
12
+ <a class="editing-button editing-red resourcebrowser-delete">
13
+ Delete
14
+
15
+ <span class="editing-resourcebrowser-counter selected-total"></span>
16
+ </a>
@@ -0,0 +1,25 @@
1
+ <div class="editing-resourcebrowser-topbar">
2
+ <div class="editing-resourcebrowser-search">
3
+ <input class="search-field" placeholder="Search", type="text" />
4
+
5
+ <button class="search-field-button">
6
+ Search
7
+ </button>
8
+ </div>
9
+
10
+ <span class="editing-button-view" data-size="large">
11
+ <span class="editing-icon editing-icon-th-large" title="large tumbnails"></span>
12
+ </span>
13
+
14
+ <span class="editing-button-view" data-size="big">
15
+ <span class="editing-icon editing-icon-th" title="big tumbnails"></span>
16
+ </span>
17
+
18
+ <span class="editing-button-view" data-size="normal">
19
+ <span class="editing-icon editing-icon-th-medium" title="normal tumbnails"></span>
20
+ </span>
21
+
22
+ <span class="editing-button-view" data-size="small">
23
+ <span class="editing-icon editing-icon-th-small" title="small tumbnails"></span>
24
+ </span>
25
+ </div>
@@ -0,0 +1,12 @@
1
+ <div class="editing-resourcebrowser-body">
2
+ <div class="editing-resourcebrowser-wrapper">
3
+ <%= render 'header' %>
4
+
5
+ <div class="editing-resourcebrowser-filter"></div>
6
+ <div class="editing-resourcebrowser-items"></div>
7
+ </div>
8
+
9
+ <div class="editing-resourcebrowser-inspector"></div>
10
+ </div>
11
+
12
+ <%= render 'buttons' %>
@@ -0,0 +1,13 @@
1
+ # Register a JavaScript search API result format used by the resource browser.
2
+ Scrivito::Configuration.register_obj_format('resourcebrowser') do |obj|
3
+ format = {
4
+ id: obj.id,
5
+ title: obj.title || obj.name,
6
+ }
7
+
8
+ if obj.respond_to?(:image?) && obj.image?
9
+ format[:preview] = obj.body_data_url
10
+ end
11
+
12
+ format
13
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+ get 'resourcebrowser', to: 'scrivito_resourcebrowser/resourcebrowser#index'
3
+ get 'resourcebrowser/inspector', to: 'scrivito_resourcebrowser/resourcebrowser#inspector'
4
+ get 'resourcebrowser/modal', to: 'scrivito_resourcebrowser/resourcebrowser#modal'
5
+ end
@@ -0,0 +1,5 @@
1
+ module ScrivitoResourcebrowser
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace ScrivitoResourcebrowser
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module ScrivitoResourcebrowser
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,4 @@
1
+ require 'scrivito_resourcebrowser/engine'
2
+
3
+ module ScrivitoResourcebrowser
4
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrivito_resourcebrowser
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Scrivito
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
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: coffee-rails
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: scrivito_sdk
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
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: pry
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
+ description: Scrivito Resource Browser
70
+ email:
71
+ - info@infopark.de
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - CHANGELOG.md
77
+ - LICENSE
78
+ - README.md
79
+ - Rakefile
80
+ - app/assets/javascripts/scrivito_resourcebrowser.js
81
+ - app/assets/javascripts/scrivito_resourcebrowser/inspector.js.coffee
82
+ - app/assets/javascripts/scrivito_resourcebrowser/resourcebrowser.js.coffee
83
+ - app/assets/javascripts/scrivito_resourcebrowser/uploader.js.coffee
84
+ - app/assets/stylesheets/scrivito_resourcebrowser.css
85
+ - app/assets/stylesheets/scrivito_resourcebrowser/resourcebrowser.css
86
+ - app/controllers/scrivito_resourcebrowser/resourcebrowser_controller.rb
87
+ - app/views/layouts/scrivito_resourcebrowser/inspector.html.erb
88
+ - app/views/scrivito_resourcebrowser/application.html.erb
89
+ - app/views/scrivito_resourcebrowser/obj/details.html
90
+ - app/views/scrivito_resourcebrowser/resourcebrowser/_buttons.html.erb
91
+ - app/views/scrivito_resourcebrowser/resourcebrowser/_header.html.erb
92
+ - app/views/scrivito_resourcebrowser/resourcebrowser/modal.html.erb
93
+ - config/initializers/resourcebrowser.rb
94
+ - config/routes.rb
95
+ - lib/scrivito_resourcebrowser.rb
96
+ - lib/scrivito_resourcebrowser/engine.rb
97
+ - lib/scrivito_resourcebrowser/version.rb
98
+ homepage: http://www.scrivito.com
99
+ licenses:
100
+ - LGPL-3.0
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '1.9'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '1.8'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.2.2
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Scrivito Resource Browser
122
+ test_files: []