Commit 705a8ec6d14f104715a7f8d994de99c39ca92b9f
1 parent
d0561132
Exists in
master
and in
29 other branches
add infra to embed feature
Showing
8 changed files
with
46 additions
and
0 deletions
Show diff stats
app/controllers/application_controller.rb
@@ -55,6 +55,17 @@ class ApplicationController < ActionController::Base | @@ -55,6 +55,17 @@ class ApplicationController < ActionController::Base | ||
55 | !@no_design_blocks && self.class.uses_design_blocks? | 55 | !@no_design_blocks && self.class.uses_design_blocks? |
56 | end | 56 | end |
57 | 57 | ||
58 | + def self.no_design_theme | ||
59 | + @no_design_theme | ||
60 | + end | ||
61 | + def self.uses_design_theme? | ||
62 | + !@no_design_theme | ||
63 | + end | ||
64 | + def uses_design_theme | ||
65 | + !@no_design_theme && self.class.uses_design_theme? | ||
66 | + end | ||
67 | + | ||
68 | + | ||
58 | # Be sure to include AuthenticationSystem in Application Controller instead | 69 | # Be sure to include AuthenticationSystem in Application Controller instead |
59 | include AuthenticatedSystem | 70 | include AuthenticatedSystem |
60 | include PermissionCheck | 71 | include PermissionCheck |
app/helpers/boxes_helper.rb
@@ -219,6 +219,18 @@ module BoxesHelper | @@ -219,6 +219,18 @@ module BoxesHelper | ||
219 | buttons << thickbox_inline_popup_icon(:help, _('Help on this block'), {}, "help-on-box-#{block.id}") << content_tag('div', content_tag('h2', _('Help')) + content_tag('div', block.help, :style => 'margin-bottom: 1em;') + thickbox_close_button(_('Close')), :style => 'display: none;', :id => "help-on-box-#{block.id}") | 219 | buttons << thickbox_inline_popup_icon(:help, _('Help on this block'), {}, "help-on-box-#{block.id}") << content_tag('div', content_tag('h2', _('Help')) + content_tag('div', block.help, :style => 'margin-bottom: 1em;') + thickbox_close_button(_('Close')), :style => 'display: none;', :id => "help-on-box-#{block.id}") |
220 | end | 220 | end |
221 | 221 | ||
222 | + #if block.respond_to?(:embedable) | ||
223 | + if true | ||
224 | + html = content_tag('div', | ||
225 | + content_tag('h2', _('Embed code')) + | ||
226 | + content_tag('div', 'Below, you''ll see a field containing embed code for the block. Just copy the code and paste it into your website or blogging software.', :style => 'margin-bottom: 1em;') + | ||
227 | + content_tag('textarea', '*This is the embed code for this block!*', :style => 'margin-bottom: 1em; width:100%; height:40%;') + | ||
228 | + thickbox_copy_to_clipboard_button(_('Copy to clipboard')) + | ||
229 | + thickbox_close_button(_('Close')), :style => 'display: none;', :id => "embed-code-box-#{block.id}") | ||
230 | + | ||
231 | + buttons << thickbox_inline_popup_icon(:embed, _('Embed code'), {}, "embed-code-box-#{block.id}") << html | ||
232 | + end | ||
233 | + | ||
222 | content_tag('div', buttons.join("\n") + tag('br', :style => 'clear: left'), :class => 'button-bar') | 234 | content_tag('div', buttons.join("\n") + tag('br', :style => 'clear: left'), :class => 'button-bar') |
223 | end | 235 | end |
224 | 236 |
app/helpers/thickbox_helper.rb
@@ -8,4 +8,7 @@ module ThickboxHelper | @@ -8,4 +8,7 @@ module ThickboxHelper | ||
8 | def thickbox_close_button(title) | 8 | def thickbox_close_button(title) |
9 | button_to_function(:close, title, 'tb_remove();') | 9 | button_to_function(:close, title, 'tb_remove();') |
10 | end | 10 | end |
11 | + def thickbox_copy_to_clipboard_button(title) | ||
12 | + button_to_function(:'copy-to-clipboard', title, 'tb_copy_to_clipboard();') | ||
13 | + end | ||
11 | end | 14 | end |
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +<%= 'bli' %> |
config/routes.rb
@@ -31,6 +31,10 @@ ActionController::Routing::Routes.draw do |map| | @@ -31,6 +31,10 @@ ActionController::Routing::Routes.draw do |map| | ||
31 | map.connect 'thumbnails/*stuff', :controller => 'not_found', :action => 'nothing' | 31 | map.connect 'thumbnails/*stuff', :controller => 'not_found', :action => 'nothing' |
32 | map.connect 'user_themes/*stuff', :controller => 'not_found', :action => 'nothing' | 32 | map.connect 'user_themes/*stuff', :controller => 'not_found', :action => 'nothing' |
33 | 33 | ||
34 | + # embed controller | ||
35 | + map.embed 'embed', :controller => 'embed', :action => 'index' | ||
36 | + map.embed_block 'embed/:block/', :controller => 'embed', :action => 'block' | ||
37 | + | ||
34 | # online documentation | 38 | # online documentation |
35 | map.doc 'doc', :controller => 'doc', :action => 'index' | 39 | map.doc 'doc', :controller => 'doc', :action => 'index' |
36 | map.doc_section 'doc/:section', :controller => 'doc', :action => 'section' | 40 | map.doc_section 'doc/:section', :controller => 'doc', :action => 'section' |
public/designs/icons/tango/style.css
1 | /******************SMALL ICONS********************/ | 1 | /******************SMALL ICONS********************/ |
2 | +.icon-embed { background-image: url(Tango/16x16/apps/utilities-terminal.png) } | ||
3 | +.icon-copy-to-clipboard { background-image: url(Tango/16x16/actions/gtk-copy.png) } | ||
2 | .icon-edit { background-image: url(Tango/16x16/apps/text-editor.png) } | 4 | .icon-edit { background-image: url(Tango/16x16/apps/text-editor.png) } |
3 | .icon-home { background-image: url(Tango/16x16/actions/go-home.png) } | 5 | .icon-home { background-image: url(Tango/16x16/actions/go-home.png) } |
4 | .icon-home-not { background-image: url(mod/16x16/actions/go-home-not.png) } | 6 | .icon-home-not { background-image: url(mod/16x16/actions/go-home-not.png) } |
public/javascripts/thickbox.js
@@ -265,6 +265,10 @@ function tb_showIframe(){ | @@ -265,6 +265,10 @@ function tb_showIframe(){ | ||
265 | jQuery("#TB_window").css({display:"block"}); | 265 | jQuery("#TB_window").css({display:"block"}); |
266 | } | 266 | } |
267 | 267 | ||
268 | +function tb_copy_to_clipboard() { | ||
269 | + alert('Text copied to clipboard!'); | ||
270 | +} | ||
271 | + | ||
268 | function tb_remove() { | 272 | function tb_remove() { |
269 | jQuery("#TB_imageOff").unbind("click"); | 273 | jQuery("#TB_imageOff").unbind("click"); |
270 | jQuery("#TB_closeWindowButton").unbind("click"); | 274 | jQuery("#TB_closeWindowButton").unbind("click"); |