Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
various fixes, use haml to draw some templates
- Loading branch information
Doug Youch
committed
Mar 21, 2011
1 parent
2d095c0
commit be99c95
Showing
23 changed files
with
332 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
%title= (@cms_page_info ? @cms_page_info[:page_title] : @title) || "CMS" | ||
%META{:CONTENT => "text/html; charset=UTF-8", "HTTP-EQUIV" => "Content-Type"} | ||
%META{:CONTENT => "NOINDEX, NOFOLLOW, NOCACHE", :NAME => "ROBOTS"} | ||
= stylesheet_link_tag 'common' | ||
= remote_stylesheet 'fonts.googleapis.com/css?family=Droid+Sans' | ||
= theme_stylesheet_link_tag "admin_design", :media => 'all' | ||
= theme_stylesheet_link_tag "admin_framework", :media => 'all' | ||
:javascript | ||
var AUTH_TOKEN = " form_authenticity_token.to_s "; | ||
= remote_script 'ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js' | ||
= remote_script 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js' | ||
:javascript | ||
$j = jQuery.noConflict(); | ||
= javascript_include_tag 'jaction' | ||
= remote_script 'www.google.com/jsapi' | ||
- unless @no_legacy_cs | ||
= javascript_include_tag :legacy | ||
= javascript_include_tag 'application' | ||
= javascript_include_tag 'active_table' | ||
= javascript_include_tag 'shortcut' | ||
= javascript_include_tag 'exporter' | ||
!= @header if @header | ||
!= @extra_header if @extra_header | ||
- if @js_header | ||
- @js_header.uniq.each do |js| | ||
- if js.to_s.include?('http://') | ||
%script{:src => js, :type => "text/javascript"} | ||
- else | ||
= javascript_include_tag js | ||
- if @css_header | ||
- @css_header.uniq.each do |css| | ||
= stylesheet_link_tag css |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
:javascript | ||
Widget = { | ||
|
||
update: function(id,params) { | ||
new Ajax.Request("#{url_for :action => 'widget'}/" + id, { parameters: params } ); | ||
} | ||
|
||
} | ||
CMSDashboard = { | ||
editing: false, | ||
|
||
|
||
updateWidgets:function() { | ||
this.editing ? this.editWidgets() : this.stopEditingWidgets(); | ||
}, | ||
|
||
editWidgets: function() { | ||
$$('.dashboard_widget_title').invoke('addClassName','dashboard_widget_titlebar_move'); | ||
$$('.dashboard_widget_column_add').invoke('show'); | ||
$$('.dashboard_widget_tools').invoke('show'); | ||
$$('.dashboard_widget_title_edit').invoke('show'); | ||
$$('.dashboard_widget_hidden').invoke('show'); | ||
|
||
this.createSortables(); | ||
this.editing = true; | ||
}, | ||
|
||
stopEditingWidgets: function() { | ||
$$('.dashboard_widget_title').invoke('removeClassName','dashboard_widget_titlebar_move'); | ||
$$('.dashboard_widget_column_add').invoke('hide'); | ||
$$('.dashboard_widget_tools').invoke('hide'); | ||
$$('.dashboard_widget_title_edit').invoke('hide'); | ||
$$('.dashboard_widget_hidden').invoke('hide'); | ||
this.destroySortables(); | ||
this.editing = false; | ||
}, | ||
|
||
toggleEdit: function() { | ||
this.editing ? this.stopEditingWidgets() : this.editWidgets(); | ||
}, | ||
|
||
destroySortables: function() { | ||
var zones = $$('.dashboard_widget_column'); | ||
zones.each(function(zone) { Sortable.destroy(zone); }); | ||
}, | ||
|
||
createSortables:function() { | ||
var zones = $$('.dashboard_widget_column'); | ||
var zone_idxs = zones.pluck('id'); | ||
|
||
zones.each(function(zone) { | ||
Sortable.create(zone.id, { | ||
dropOnEmpty:true, | ||
handle:'dashboard_widget_titlebar', | ||
tag:'div', | ||
only:'dashboard_widget', | ||
containment: zone_idxs, | ||
constraint:false, | ||
onUpdate: CMSDashboard.updatePositions | ||
}); | ||
}); | ||
}, | ||
|
||
positionTimer: null, | ||
|
||
updatePositions: function() { | ||
if(CMSDashboard.positionTimer) clearTimeout(CMSDashboard.positionTimer); | ||
CMSDashboard.positionTimer = setTimeout(CMSDashboard.submitPositions,20); | ||
}, | ||
|
||
submitPositions: function() { | ||
CMSDashboard.positionTimer = null; | ||
var zones = $$('.dashboard_widget_column'); | ||
var params = zones.map(function(zone) { return Sortable.serialize(zone) }).join("&"); | ||
new Ajax.Request('#{url_for(:action => 'positions')}',{ parameters: params }); | ||
}, | ||
|
||
addWidget: function(column) { | ||
SCMS.remoteOverlay("#{url_for(:action => 'edit')}", { column: column }); | ||
}, | ||
|
||
submitWidgetForm: function(params) { | ||
SCMS.updateOverlay("#{url_for(:action => 'edit')}", params); | ||
}, | ||
|
||
editWidget: function(widget_id) { | ||
SCMS.remoteOverlay("#{url_for(:action => 'edit')}", { widget_id: widget_id }); | ||
}, | ||
|
||
deleteWidget: function(widget_id) { | ||
if(confirm("Are you sure you want to permanently delete your widget?")) { | ||
new Ajax.Request('#{url_for(:action => 'remove')}', { parameters: { widget_id: widget_id } }); | ||
} | ||
|
||
}, | ||
|
||
hideWidget: function(widget_id) { | ||
if(confirm("Are you sure you want to hide this site widget (you will be able to added back again later)?")) { | ||
new Ajax.Request('#{url_for(:action => 'remove')}', { parameters: { widget_id: widget_id }}); | ||
} | ||
}, | ||
|
||
showWidget: function(widget_id) { | ||
new Ajax.Request('#{url_for(:action => 'show')}', { parameters: { widget_id: widget_id }}); | ||
} | ||
|
||
|
||
}; | ||
|
||
|
||
= action_panel :more => myself.has_role?(:editor_site_management) do |p| | ||
= p.link 'Edit Widgets', { :icon => 'add.png', :url => 'javascript:void(0);', :id => 'edit_widgets' }, :onclick => 'CMSDashboard.editWidgets();', :"j-action" => 'swap', :swap => '#stop_editing_widgets,#edit_widgets' | ||
= p.link 'Stop Editing Widgets', { :icon => 'remove.png', :hidden => true, :url => 'javascript:void(0);', :id => 'stop_editing_widgets' }, :onclick => 'CMSDashboard.stopEditingWidgets();', :"j-action" => 'swap', :swap => '#edit_widgets,#stop_editing_widgets' | ||
- if myself.has_role?(:editor_site_management) | ||
- more_action_panel do |p| | ||
= p.link 'Edit Site Widgets',:action => :site_widgets | ||
%hr/ | ||
%table{:cellpadding => "0", :cellspacing => "0", :width => "100%"} | ||
%tr | ||
- width = (100.0 / @widget_columns.length).floor; | ||
- @widget_columns.each_with_index do |column,idx| | ||
%td{:style => "width:#{width}%;", :valign => "top"} | ||
.dashboard_widget_column_add{:onclick => "CMSDashboard.addWidget(#{idx});", :style => "display:none;"} Add Widget Here | ||
.dashboard_widget_column{:id => "column_#{idx}"} | ||
- column.each do |widget| | ||
= render :partial => 'widget', :locals => {:widget => widget } |
Oops, something went wrong.