tandem 0.2.0.rc
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.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +205 -0
- data/Rakefile +31 -0
- data/app/assets/images/tandem/blank_image.jpg +0 -0
- data/app/assets/images/tandem/colorbox/border1.png +0 -0
- data/app/assets/images/tandem/colorbox/border2.png +0 -0
- data/app/assets/images/tandem/colorbox/ie6/borderBottomCenter.png +0 -0
- data/app/assets/images/tandem/colorbox/ie6/borderBottomLeft.png +0 -0
- data/app/assets/images/tandem/colorbox/ie6/borderBottomRight.png +0 -0
- data/app/assets/images/tandem/colorbox/ie6/borderMiddleLeft.png +0 -0
- data/app/assets/images/tandem/colorbox/ie6/borderMiddleRight.png +0 -0
- data/app/assets/images/tandem/colorbox/ie6/borderTopCenter.png +0 -0
- data/app/assets/images/tandem/colorbox/ie6/borderTopLeft.png +0 -0
- data/app/assets/images/tandem/colorbox/ie6/borderTopRight.png +0 -0
- data/app/assets/images/tandem/colorbox/loading.gif +0 -0
- data/app/assets/images/tandem/ic-delete_image.png +0 -0
- data/app/assets/images/tandem/ic-star.png +0 -0
- data/app/assets/images/tandem/loader.gif +0 -0
- data/app/assets/images/tandem/loader_stripe.png +0 -0
- data/app/assets/images/tandem/tandem-editImage2.jpg +0 -0
- data/app/assets/images/tandem/tandem_logo.png +0 -0
- data/app/assets/images/tandem/tandem_logo_nav.png +0 -0
- data/app/assets/javascripts/tandem/contents.js +2 -0
- data/app/assets/javascripts/tandem/current_image.jst.eco +19 -0
- data/app/assets/javascripts/tandem/gallery_image.jst.eco +10 -0
- data/app/assets/javascripts/tandem/images.coffee +42 -0
- data/app/assets/javascripts/tandem/pages.js.coffee +32 -0
- data/app/assets/javascripts/tandem/popup.js +23 -0
- data/app/assets/javascripts/tandem.js +16 -0
- data/app/assets/stylesheets/tandem/colorbox.css.erb +83 -0
- data/app/assets/stylesheets/tandem/contents.scss +541 -0
- data/app/assets/stylesheets/tandem/scaffold.scss +61 -0
- data/app/assets/stylesheets/tandem/variables.scss +38 -0
- data/app/assets/stylesheets/tandem.css +7 -0
- data/app/controllers/tandem/application_controller.rb +19 -0
- data/app/controllers/tandem/contents_controller.rb +94 -0
- data/app/controllers/tandem/images_controller.rb +92 -0
- data/app/controllers/tandem/pages_controller.rb +108 -0
- data/app/helpers/tandem/application_helper.rb +29 -0
- data/app/helpers/tandem/contents_helper.rb +19 -0
- data/app/helpers/tandem/images_helper.rb +10 -0
- data/app/helpers/tandem/pages_helper.rb +243 -0
- data/app/models/tandem/ability.rb +6 -0
- data/app/models/tandem/content/image.rb +7 -0
- data/app/models/tandem/content/text.rb +7 -0
- data/app/models/tandem/content.rb +41 -0
- data/app/models/tandem/image.rb +27 -0
- data/app/models/tandem/page.rb +41 -0
- data/app/views/layouts/tandem/image.html.slim +19 -0
- data/app/views/layouts/tandem/popup.html.slim +17 -0
- data/app/views/tandem/contents/_form.html.slim +36 -0
- data/app/views/tandem/contents/edit.html.slim +3 -0
- data/app/views/tandem/contents/index.html.slim +29 -0
- data/app/views/tandem/contents/new.html.slim +3 -0
- data/app/views/tandem/contents/show.html.slim +20 -0
- data/app/views/tandem/images/_form.html.slim +24 -0
- data/app/views/tandem/images/_gallery.html.slim +4 -0
- data/app/views/tandem/images/edit.html.slim +8 -0
- data/app/views/tandem/images/index.html.slim +9 -0
- data/app/views/tandem/images/new.html.slim +4 -0
- data/app/views/tandem/images/show.html.slim +10 -0
- data/app/views/tandem/images/thumb.html.slim +1 -0
- data/app/views/tandem/pages/_form.html.slim +56 -0
- data/app/views/tandem/pages/edit.html.slim +1 -0
- data/app/views/tandem/pages/index.html.slim +35 -0
- data/app/views/tandem/pages/new.html.slim +1 -0
- data/app/views/tandem/pages/show.html.slim +16 -0
- data/config/cucumber.yml +8 -0
- data/config/routes.rb +17 -0
- data/db/migrate/20111122221549_create_tandem_pages.rb +20 -0
- data/db/migrate/20111122222037_create_tandem_contents.rb +21 -0
- data/db/migrate/20111215001943_create_tandem_images.rb +12 -0
- data/db/migrate/30000000000000_create_default_page.rb +10 -0
- data/db/migrate/30000000000001_add_request_key_to_tandem_contents.rb +44 -0
- data/lib/generators/tandem_generator.rb +26 -0
- data/lib/generators/templates/initializer.rb +70 -0
- data/lib/tandem/engine.rb +23 -0
- data/lib/tandem/version.rb +3 -0
- data/lib/tandem.rb +46 -0
- data/lib/tasks/cucumber.rake +65 -0
- data/lib/tasks/tandem_tasks.rake +4 -0
- metadata +354 -0
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2011 YOURNAME
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
= Tandem CMS
|
|
2
|
+
|
|
3
|
+
Tandme is a content management system (CMS) for Rails 3.1+. We felt like it was
|
|
4
|
+
needed because too many of the CMS options for Rails are either
|
|
5
|
+
unpolished—something we wouldn't want to put in front of our clients or bloated
|
|
6
|
+
and heavy, causing many headaches when trying to integrate into existing
|
|
7
|
+
applications.
|
|
8
|
+
|
|
9
|
+
Tandem was designed to be as simple as can be to integrate into a
|
|
10
|
+
larger application. It's a mountable engine that allows you to easily specify
|
|
11
|
+
how it fits into a larger application and doesn't bring any opinions about how
|
|
12
|
+
that application is architected.
|
|
13
|
+
|
|
14
|
+
The simplicity doesn't stop there, though. It also has the end user in mind.
|
|
15
|
+
Through in-place editing, users simply navigate their site like they normally
|
|
16
|
+
would. If they want to edit something, they simply click on it, edit it, and go
|
|
17
|
+
on their merry way.
|
|
18
|
+
|
|
19
|
+
It's early in the life of Tandem and we have lots in store, but it's something
|
|
20
|
+
we find useful and hope you will too.
|
|
21
|
+
|
|
22
|
+
== Getting Started / Installation
|
|
23
|
+
|
|
24
|
+
Has it ever been easier to check off that "CMS functionality" feature story?
|
|
25
|
+
|
|
26
|
+
This assumes you have a rails app already. If you don't, <tt>rails new tanem_app</tt>
|
|
27
|
+
|
|
28
|
+
1. Add the tandem gem to your Gemfile
|
|
29
|
+
|
|
30
|
+
gem 'tandem'
|
|
31
|
+
|
|
32
|
+
2. Install the gem
|
|
33
|
+
|
|
34
|
+
bundle install
|
|
35
|
+
|
|
36
|
+
3. Generate the tandem files
|
|
37
|
+
|
|
38
|
+
rails g tandem
|
|
39
|
+
|
|
40
|
+
4. Migrate
|
|
41
|
+
|
|
42
|
+
rake db:migrate
|
|
43
|
+
|
|
44
|
+
5. Start your app and you're ready to go.
|
|
45
|
+
|
|
46
|
+
rails s
|
|
47
|
+
|
|
48
|
+
== Upgrading
|
|
49
|
+
|
|
50
|
+
Upgrade just like you would any other engine.
|
|
51
|
+
|
|
52
|
+
1. Update the gem version to the latest version in your gemfile if you specify a version.
|
|
53
|
+
|
|
54
|
+
gem 'tandem', '~> 0.2'
|
|
55
|
+
|
|
56
|
+
2. Install the updated gem
|
|
57
|
+
|
|
58
|
+
bundle update tandem
|
|
59
|
+
|
|
60
|
+
3. Copy any new migrations from tandem
|
|
61
|
+
|
|
62
|
+
rake tandem:install:migrations
|
|
63
|
+
|
|
64
|
+
4. Migrate
|
|
65
|
+
|
|
66
|
+
rake db:migrate
|
|
67
|
+
|
|
68
|
+
5. Enjoy the new tandem goodness.
|
|
69
|
+
|
|
70
|
+
rails s
|
|
71
|
+
|
|
72
|
+
== Usage
|
|
73
|
+
|
|
74
|
+
By default, Tandem uses your application layout and Tandem's pages/show template to
|
|
75
|
+
render pages. Both of these can be customized for an individual page.
|
|
76
|
+
|
|
77
|
+
=== Custom pages
|
|
78
|
+
|
|
79
|
+
With Tandem, you can easily insert editable content into your page by using the simple
|
|
80
|
+
helpers, <tt>tandem_text_tag</tt> and <tt>tandem_image_tag</tt>.
|
|
81
|
+
|
|
82
|
+
Simply insert those into your templates where you want the user to be able to
|
|
83
|
+
edit content and Tandem will take care of the rest.
|
|
84
|
+
|
|
85
|
+
<div id="sidebar">
|
|
86
|
+
<%= tandem_image_tag(:sidebar_image)
|
|
87
|
+
<%= tandem_text_tag(:sidebar_text)
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
The tandem_text_tag defaults to a basic text area. If you'd like to offer a WYSIWYG editor,
|
|
91
|
+
you can set the <tt>editor</tt> option to <tt>:wysiwyg</tt>:
|
|
92
|
+
|
|
93
|
+
<%= tandem_text_tag(:sidebar_text, editor: :wysiwyg) %>
|
|
94
|
+
|
|
95
|
+
=== Navigation
|
|
96
|
+
|
|
97
|
+
Tandem comes with a helper method to add a navigation menu. It's not included in the default
|
|
98
|
+
views, since it will most likely be used in your app's application layout. Adding it is easy,
|
|
99
|
+
though.
|
|
100
|
+
|
|
101
|
+
<%= tandem_navigation_tag(@page) %>
|
|
102
|
+
|
|
103
|
+
By default, Tandem will produce a nested tree of all your pages. If you just want the top level:
|
|
104
|
+
|
|
105
|
+
<%= tandem_navigation_tag(@page, Tandem::Page.top_level) %>
|
|
106
|
+
|
|
107
|
+
If you want to show just the subnavication for a given page:
|
|
108
|
+
|
|
109
|
+
<%= tandem_navigation_tag(@page, @page.children) %>
|
|
110
|
+
|
|
111
|
+
You can also create submenus easily by passing in a custom collection of pages, e.g.
|
|
112
|
+
|
|
113
|
+
<%= tandem_navigation_tag(@page, Tandem::Page.find_by_title('Services').children) %>
|
|
114
|
+
|
|
115
|
+
== Authentication
|
|
116
|
+
|
|
117
|
+
Now, most apps don't simply want to let anyone edit content. Tandem allows you to easily
|
|
118
|
+
specify how it should control access.
|
|
119
|
+
|
|
120
|
+
Inside config/initializers/tandem.rb, you can define procs for Tandem to use for
|
|
121
|
+
authentication and authorization.
|
|
122
|
+
|
|
123
|
+
1. Tell Tandem how to find the current_user
|
|
124
|
+
|
|
125
|
+
Tandem::Configuration.current_user_proc { |request|
|
|
126
|
+
User.find(request.session['user_id']) unless request.session['user_id'].blank?
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
2. Define what each user can do using CanCan
|
|
130
|
+
|
|
131
|
+
Tandem::Configuration.user_abilities_proc { |user|
|
|
132
|
+
user ||= User.new # guest user (not logged in)
|
|
133
|
+
|
|
134
|
+
if user.admin?
|
|
135
|
+
can :manage, :all
|
|
136
|
+
else
|
|
137
|
+
can :read, :all
|
|
138
|
+
end
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
== Paperclip configuration
|
|
142
|
+
|
|
143
|
+
Tandem uses paperclip for file uploads. If your application needs to modify its settings,
|
|
144
|
+
simply set the Tandem::Configuration.paperclip_options in /config/initializers/tandem.rb
|
|
145
|
+
|
|
146
|
+
For example, to store images on S3, add the aws-sdk gem to your Gemfile and set
|
|
147
|
+
paperclip_options to:
|
|
148
|
+
|
|
149
|
+
Tandem::Configuration.paperclip_options = { :styles => { :thumb => "150x150>" },
|
|
150
|
+
:storage => :s3,
|
|
151
|
+
:bucket => Proc.new { Rails.application.engine_name.gsub(/application$/, Rails.env) },
|
|
152
|
+
:s3_credentials => {
|
|
153
|
+
:access_key_id => ENV['S3_KEY'],
|
|
154
|
+
:secret_access_key => ENV['S3_SECRET']
|
|
155
|
+
} }
|
|
156
|
+
|
|
157
|
+
== Other Options
|
|
158
|
+
|
|
159
|
+
By default, Tandem mounts to the root of your application. We're not trying to be pushy,
|
|
160
|
+
it's just what we find ourselves doing 90% of the time. To change this, simply modify your
|
|
161
|
+
config/routes.rb to something like:
|
|
162
|
+
|
|
163
|
+
mount Tandem::Engine => "/tandem"
|
|
164
|
+
|
|
165
|
+
To change the url that you wish to serve unauthorized access errors supply a value to:
|
|
166
|
+
|
|
167
|
+
Tandem::Configuration.unauthorized_path
|
|
168
|
+
|
|
169
|
+
By default, the tandem generator copies all tandem layouts to app/views/layouts/tandem.
|
|
170
|
+
If you wish to move your layouts to another location, supply a value to:
|
|
171
|
+
|
|
172
|
+
Tandem::Configuration.layouts_dir
|
|
173
|
+
|
|
174
|
+
By default, the uploaded images directly in the asset pipeline at :rails_root/public.
|
|
175
|
+
To change this location, supply a value to:
|
|
176
|
+
|
|
177
|
+
Tandem::Configuration.uploaded_images_dir
|
|
178
|
+
|
|
179
|
+
By default, the uploaded images are stored and accessed via the default "paperclip"
|
|
180
|
+
conventions (see paperclip gem). To change this behavior, supply a value to:
|
|
181
|
+
|
|
182
|
+
Tandem::Configuration.uploaded_images_template
|
|
183
|
+
|
|
184
|
+
=== Styling
|
|
185
|
+
|
|
186
|
+
Every new Tandem default page created has pre-defined classes setup to use either Bootstrap or 960.gs.
|
|
187
|
+
|
|
188
|
+
Here's a preview of what the html looks like:
|
|
189
|
+
|
|
190
|
+
.container_12.row.clearfix
|
|
191
|
+
p#notice = notice
|
|
192
|
+
.grid_12.span12
|
|
193
|
+
= tandem_image_tag(@page, :default_image)
|
|
194
|
+
.grid_7.span7
|
|
195
|
+
= tandem_text_tag(@page, :tandem_text_block)
|
|
196
|
+
.grid_5.span5
|
|
197
|
+
= tandem_text_tag(@page, :tandem_sidebar)
|
|
198
|
+
|
|
199
|
+
If either of those grid systems are being used those styles will pull in accordingly.
|
|
200
|
+
|
|
201
|
+
== License
|
|
202
|
+
|
|
203
|
+
Tandem is released under the MIT license:
|
|
204
|
+
|
|
205
|
+
* http://www.opensource.org/licenses/MIT
|
data/Rakefile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
begin
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
rescue LoadError
|
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
6
|
+
end
|
|
7
|
+
begin
|
|
8
|
+
require 'rdoc/task'
|
|
9
|
+
rescue LoadError
|
|
10
|
+
require 'rdoc/rdoc'
|
|
11
|
+
require 'rake/rdoctask'
|
|
12
|
+
RDoc::Task = Rake::RDocTask
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
17
|
+
rdoc.title = 'Tandem'
|
|
18
|
+
rdoc.options << '--line-numbers'
|
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
load 'lib/tasks/tandem_tasks.rake'
|
|
24
|
+
|
|
25
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
|
26
|
+
load 'rails/tasks/engine.rake'
|
|
27
|
+
|
|
28
|
+
Bundler::GemHelper.install_tasks
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<% @resource_updated_at = new Date @resource_updated_at %>
|
|
2
|
+
<% @formatted_resource_updated_at = "#{@resource_updated_at.getMonth() + 1}/#{@resource_updated_at.getDate()}/#{@resource_updated_at.getFullYear()}" %>
|
|
3
|
+
|
|
4
|
+
<div class="clearfix" id="current-image">
|
|
5
|
+
<input id="content_image_image_id" name="content_image[image_id]" type="hidden" value="<%= @id %>" />
|
|
6
|
+
|
|
7
|
+
<h3 id="selected_image_title">Current Image</h3>
|
|
8
|
+
|
|
9
|
+
<div class="clearfix" id="selected_image_viewpane">
|
|
10
|
+
<img alt="<%= @resource_file_name %>" src="<%= if @thumb_url? then @thumb_url else '/assets/tandem/blank_image.jpg' %>" style="" />
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<% if @thumb_url?: %>
|
|
14
|
+
<ul id="tandem_image_attributes">
|
|
15
|
+
<li class="image_name"><%= @resource_file_name %></li>
|
|
16
|
+
<li>Last Modified: <%= @formatted_resource_updated_at %></li>
|
|
17
|
+
</ul>
|
|
18
|
+
<% end %>
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<li>
|
|
2
|
+
<span>
|
|
3
|
+
<img alt="<%= @resource_file_name %>" data-id="<%= @id %>" data-resource_file_name="<%= @resource_file_name %>" data-resource_updated_at="<%= @resource_updated_at %>" data-thumb_url="<%= @thumb_url %>" src="<%= @thumb_url %>" />
|
|
4
|
+
</span>
|
|
5
|
+
|
|
6
|
+
<p>
|
|
7
|
+
<%= @resource_file_name %>
|
|
8
|
+
<!--<a class="delete_image" href="#"></a> -->
|
|
9
|
+
</p>
|
|
10
|
+
</li>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Place all the behaviors and hooks related to the matching controller here.
|
|
2
|
+
# All this logic will automatically be available in application.js.
|
|
3
|
+
#= require tandem/current_image
|
|
4
|
+
#= require tandem/gallery_image
|
|
5
|
+
|
|
6
|
+
$(document).ready ->
|
|
7
|
+
$("#new_tandem_image input[type=file][name='image[resource]']").fileupload
|
|
8
|
+
dataType: 'json'
|
|
9
|
+
url: $(this).closest('form').attr('action')
|
|
10
|
+
|
|
11
|
+
done: (e, data) ->
|
|
12
|
+
$('#tandem_image_gallery ul').prepend(window.JST['tandem/gallery_image'](data.result))
|
|
13
|
+
$('div#current-image').replaceWith(window.JST['tandem/current_image'](data.result))
|
|
14
|
+
|
|
15
|
+
progress: (e, data) ->
|
|
16
|
+
progress = parseInt(data.loaded / data.total * 100, 10) + '%'
|
|
17
|
+
$('div#tandem-upload-image div.loader div.range').css({width: progress})
|
|
18
|
+
$('div#tandem-upload-image div.loader div.range span').text(progress)
|
|
19
|
+
|
|
20
|
+
start: (e, data) ->
|
|
21
|
+
$('div#tandem-upload-image div.loader').show()
|
|
22
|
+
$(e.target).closest('form').find('section#error_explanation').hide()
|
|
23
|
+
|
|
24
|
+
always: (e, data) ->
|
|
25
|
+
$('div#tandem-upload-image div.loader').hide()
|
|
26
|
+
|
|
27
|
+
fail: (e, data) ->
|
|
28
|
+
errors = $.parseJSON(data.jqXHR.responseText)
|
|
29
|
+
errorSection = $(e.target).closest('form').find('section#error_explanation')
|
|
30
|
+
errorList = errorSection.find('ul')
|
|
31
|
+
errorList.html('')
|
|
32
|
+
errorSection.show()
|
|
33
|
+
|
|
34
|
+
$.each errors, (attribute, error) ->
|
|
35
|
+
errorList.append("<li>#{attribute} #{error}</li>")
|
|
36
|
+
|
|
37
|
+
$('section#tandem_image_gallery ul').click (event) ->
|
|
38
|
+
image = $(event.target).closest('li').find('img')
|
|
39
|
+
|
|
40
|
+
if image.length > 0
|
|
41
|
+
$('div#current-image').replaceWith(window.JST['tandem/current_image'](image.data()))
|
|
42
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Place all the behaviors and hooks related to the matching controller here.
|
|
2
|
+
# All this logic will automatically be available in application.js.
|
|
3
|
+
|
|
4
|
+
$(document).ready ->
|
|
5
|
+
$('.page_link').colorbox()
|
|
6
|
+
|
|
7
|
+
if $('#tandem_page_links').length > 0
|
|
8
|
+
$('body').addClass('tandem-admin-bar')
|
|
9
|
+
|
|
10
|
+
$('div.tandem_content').on
|
|
11
|
+
'mouseenter': ->
|
|
12
|
+
$('div.tandem_toolbar', $(this)).fadeIn('slow')
|
|
13
|
+
|
|
14
|
+
'mouseleave': ->
|
|
15
|
+
$('div.tandem_toolbar', $(this)).fadeOut('slow')
|
|
16
|
+
|
|
17
|
+
'click': ->
|
|
18
|
+
$.fn.colorbox
|
|
19
|
+
href: $('a.tandem_edit_link', $(this)).attr('href')
|
|
20
|
+
iframe: true
|
|
21
|
+
width: '95%'
|
|
22
|
+
height: '90%'
|
|
23
|
+
open: true
|
|
24
|
+
return false
|
|
25
|
+
|
|
26
|
+
$(document).on 'ajax:success', 'form.tandem-page-form', (event, content, status, jqXHR) ->
|
|
27
|
+
returnedForm = $('form.tandem-page-form', content)
|
|
28
|
+
|
|
29
|
+
if returnedForm.find('#error_explanation').length > 0
|
|
30
|
+
$('form.tandem-page-form').replaceWith returnedForm
|
|
31
|
+
else
|
|
32
|
+
window.location.reload()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Place all the behaviors and hooks related to the matching controller here.
|
|
2
|
+
// All this logic will automatically be available in application.js.
|
|
3
|
+
|
|
4
|
+
$().ready(function () {
|
|
5
|
+
$('form.tandem_content_editor').on('ajax:success', function(event, content, status, jqXHR){
|
|
6
|
+
$.get(parent.location.href, function(data, status, jqXHR){
|
|
7
|
+
var content_id = '#' + content.tag;
|
|
8
|
+
|
|
9
|
+
$(content_id, parent.document).html( $(content_id, data).html() );
|
|
10
|
+
parent.$.fn.colorbox.close();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
$('.wymeditor').wymeditor({ wymPath: '/assets/tandem/wymeditor/jquery.wymeditor.min.js',
|
|
15
|
+
basePath: '/assets/tandem/wymeditor/',
|
|
16
|
+
skinPath: "/assets/tandem/wymeditor/skins/default/",
|
|
17
|
+
jQueryPath: "/assets/jquery.js"
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
$('h3.settings-toggle').live('click', function () {
|
|
21
|
+
$('div.advanced-settings').slideToggle('slow');
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
5
|
+
// the compiled file.
|
|
6
|
+
//
|
|
7
|
+
//= require jquery
|
|
8
|
+
//= require jquery_ujs
|
|
9
|
+
//= require tandem/modernizr-2.5.3.min
|
|
10
|
+
//= require tandem/jquery.colorbox
|
|
11
|
+
//= require tandem/wymeditor/jquery.wymeditor.min
|
|
12
|
+
//= require tandem/jquery.ui.widget
|
|
13
|
+
//= require tandem/jquery-fileupload
|
|
14
|
+
//= require tandem/pages
|
|
15
|
+
//= require tandem/images
|
|
16
|
+
//= require tandem/popup
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
ColorBox Core Style:
|
|
4
|
+
The following CSS is consistent between example themes and should not be altered.
|
|
5
|
+
*/
|
|
6
|
+
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
|
|
7
|
+
#cboxOverlay{position:fixed; width:100%; height:100%;}
|
|
8
|
+
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
|
|
9
|
+
#cboxContent{position:relative;}
|
|
10
|
+
#cboxLoadedContent{overflow:auto;}
|
|
11
|
+
#cboxTitle{margin:0;}
|
|
12
|
+
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
|
|
13
|
+
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
|
|
14
|
+
.cboxPhoto{float:left; margin:auto; border:0; display:block;}
|
|
15
|
+
.cboxIframe{width:100%; height:100%; display:block; border:0;}
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
User Style:
|
|
19
|
+
Change the following styles to modify the appearance of ColorBox. They are
|
|
20
|
+
ordered & tabbed in a way that represents the nesting of the generated HTML.
|
|
21
|
+
*/
|
|
22
|
+
#cboxOverlay{background:#fff;}
|
|
23
|
+
#colorbox{}
|
|
24
|
+
#cboxTopLeft{width:25px; height:25px; background:url('<%=image_path('tandem/colorbox/border1.png')%>') no-repeat 0 0;}
|
|
25
|
+
#cboxTopCenter{height:25px; background:url('<%=image_path('tandem/colorbox/border1.png')%>') repeat-x 0 -50px;}
|
|
26
|
+
#cboxTopRight{width:25px; height:25px; background:url('<%=image_path('tandem/colorbox/border1.png')%>') no-repeat -25px 0;}
|
|
27
|
+
#cboxBottomLeft{width:25px; height:25px; background:url('<%=image_path('tandem/colorbox/border1.png')%>') no-repeat 0 -25px;}
|
|
28
|
+
#cboxBottomCenter{height:25px; background:url('<%=image_path('tandem/colorbox/border1.png')%>') repeat-x 0 -75px;}
|
|
29
|
+
#cboxBottomRight{width:25px; height:25px; background:url('<%=image_path('tandem/colorbox/border1.png')%>') no-repeat -25px -25px;}
|
|
30
|
+
#cboxMiddleLeft{width:25px; background:url('<%=image_path('tandem/colorbox/border2.png')%>') repeat-y 0 0;}
|
|
31
|
+
#cboxMiddleRight{width:25px; background:url('<%=image_path('tandem/colorbox/border2.png')%>') repeat-y -25px 0;}
|
|
32
|
+
#cboxContent{background:#fff; overflow:hidden;}
|
|
33
|
+
.cboxIframe{background:#fff;}
|
|
34
|
+
#cboxError{padding:50px; border:1px solid #ccc;}
|
|
35
|
+
#cboxLoadedContent{margin-bottom:20px;}
|
|
36
|
+
#cboxTitle{position:absolute; bottom:0px; left:0; text-align:center; width:100%; color:#999;}
|
|
37
|
+
#cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999;}
|
|
38
|
+
#cboxSlideshow{position:absolute; bottom:0px; right:42px; color:#444;}
|
|
39
|
+
#cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;}
|
|
40
|
+
#cboxNext{position:absolute; bottom:0px; left:63px; color:#444;}
|
|
41
|
+
#cboxLoadingOverlay{background:#fff url('<%=image_path('tandem/colorbox/loading.gif')%>') no-repeat 5px 5px;}
|
|
42
|
+
#cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;}
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
|
|
46
|
+
when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
|
|
47
|
+
See: http://jacklmoore.com/notes/ie-transparency-problems/
|
|
48
|
+
*/
|
|
49
|
+
.cboxIE #cboxTopLeft,
|
|
50
|
+
.cboxIE #cboxTopCenter,
|
|
51
|
+
.cboxIE #cboxTopRight,
|
|
52
|
+
.cboxIE #cboxBottomLeft,
|
|
53
|
+
.cboxIE #cboxBottomCenter,
|
|
54
|
+
.cboxIE #cboxBottomRight,
|
|
55
|
+
.cboxIE #cboxMiddleLeft,
|
|
56
|
+
.cboxIE #cboxMiddleRight {
|
|
57
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
The following provides PNG transparency support for IE6
|
|
62
|
+
Feel free to remove this and the /ie6/ directory if you have dropped IE6 support.
|
|
63
|
+
*/
|
|
64
|
+
.cboxIE6 #cboxTopLeft{background:url('<%=image_path('tandem/colorbox/ie6/borderTopLeft.png')%>');}
|
|
65
|
+
.cboxIE6 #cboxTopCenter{background:url('<%=image_path('tandem/colorbox/ie6/borderTopCenter.png')%>');}
|
|
66
|
+
.cboxIE6 #cboxTopRight{background:url('<%=image_path('tandem/colorbox/ie6/borderTopRight.png')%>');}
|
|
67
|
+
.cboxIE6 #cboxBottomLeft{background:url('<%=image_path('tandem/colorbox/ie6/borderBottomLeft.png')%>');}
|
|
68
|
+
.cboxIE6 #cboxBottomCenter{background:url('<%=image_path('tandem/colorbox/ie6/borderBottomCenter.png')%>');}
|
|
69
|
+
.cboxIE6 #cboxBottomRight{background:url('<%=image_path('tandem/colorbox/ie6/borderBottomRight.png')%>');}
|
|
70
|
+
.cboxIE6 #cboxMiddleLeft{background:url('<%=image_path('tandem/colorbox/ie6/borderMiddleLeft.png')%>');}
|
|
71
|
+
.cboxIE6 #cboxMiddleRight{background:url('<%=image_path('tandem/colorbox/ie6/borderMiddleRight.png')%>');}
|
|
72
|
+
|
|
73
|
+
.cboxIE6 #cboxTopLeft,
|
|
74
|
+
.cboxIE6 #cboxTopCenter,
|
|
75
|
+
.cboxIE6 #cboxTopRight,
|
|
76
|
+
.cboxIE6 #cboxBottomLeft,
|
|
77
|
+
.cboxIE6 #cboxBottomCenter,
|
|
78
|
+
.cboxIE6 #cboxBottomRight,
|
|
79
|
+
.cboxIE6 #cboxMiddleLeft,
|
|
80
|
+
.cboxIE6 #cboxMiddleRight {
|
|
81
|
+
_behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')");
|
|
82
|
+
}
|
|
83
|
+
|