Navigation Menu

Skip to content

Commit

Permalink
removed haml, and adjusted object notation to support ruby 1.8.7 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jejacks0n committed Jun 24, 2011
1 parent e1cc694 commit fda1545
Show file tree
Hide file tree
Showing 38 changed files with 643 additions and 608 deletions.
7 changes: 3 additions & 4 deletions Gemfile
Expand Up @@ -4,22 +4,21 @@ gem 'rails', '3.1.0.rc4'

# Assets and forms
gem 'paperclip'
gem 'formtastic', git: 'git://github.com/justinfrench/formtastic.git'
gem 'formtastic', :git => 'git://github.com/justinfrench/formtastic.git'

# Asset template engines
gem 'json'
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-script'
gem 'haml'

group :development, :test do
gem 'uglifier'
gem 'jquery-rails'
gem 'jeweler'
gem 'sqlite3'
gem 'thin'
gem 'ruby-debug19', require: 'ruby-debug'
gem 'evergreen', git: 'git://github.com/jnicklas/evergreen.git', submodules: true, require: 'evergreen/rails'
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'evergreen', :git => 'git://github.com/jnicklas/evergreen.git', :submodules => true, :require => 'evergreen/rails'
end

group :test do
Expand Down
2 changes: 0 additions & 2 deletions Gemfile.lock
Expand Up @@ -96,7 +96,6 @@ GEM
gherkin (2.4.0)
json (>= 1.4.6)
git (1.2.5)
haml (3.1.2)
hike (1.1.0)
i18n (0.6.0)
jeweler (1.6.2)
Expand Down Expand Up @@ -207,7 +206,6 @@ DEPENDENCIES
database_cleaner
evergreen!
formtastic!
haml
jeweler
jquery-rails
json
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/mercury/regions/editable.js.coffee
Expand Up @@ -18,7 +18,7 @@ class @Mercury.Regions.Editable extends Mercury.Region
@specialContainer = jQuery.browser.mozilla && @element.get(0).tagName != 'DIV'

# make it editable
# gecko: in this makes double clicking in textareas fail: https://bugzilla.mozilla.org/show_bug.cgi?id=490367
# mozilla: this makes double clicking in textareas fail: https://bugzilla.mozilla.org/show_bug.cgi?id=490367
@element.get(0).contentEditable = true

# make all snippets not editable, and set their versions to 1
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/mercury_controller.rb
Expand Up @@ -2,19 +2,19 @@ class MercuryController < ActionController::Base
protect_from_forgery

def edit
render text: '', layout: 'mercury'
render :text => '', :layout => 'mercury'
end

def resource
render action: "/#{params[:type]}/#{params[:resource]}", layout: false
render :action => "/#{params[:type]}/#{params[:resource]}", :layout => false
end

def snippet_options
render action: "/snippets/#{params[:name]}_options", layout: false
render :action => "/snippets/#{params[:name]}_options", :layout => false
end

def snippet_preview
render action: "/snippets/#{params[:name]}", layout: false
render :action => "/snippets/#{params[:name]}", :layout => false
end

end
4 changes: 2 additions & 2 deletions app/models/image.rb
@@ -1,8 +1,8 @@
class Image < ActiveRecord::Base

has_attached_file :image, styles: { medium: "300x300>", thumb: "100x100>" }
has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" }

delegate :url, to: :image
delegate :url, :to => :image

def serializable_hash(options = nil)
options ||= {}
Expand Down
14 changes: 14 additions & 0 deletions app/views/layouts/mercury.html.erb
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<%= csrf_meta_tags %>
<title>Mercury Editor</title>
<link href="/assets/mercury.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/assets/mercury.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
new Mercury.PageEditor()
</script>
</body>
</html>
8 changes: 0 additions & 8 deletions app/views/layouts/mercury.html.haml

This file was deleted.

253 changes: 253 additions & 0 deletions app/views/mercury/modals/character.html.erb

Large diffs are not rendered by default.

252 changes: 0 additions & 252 deletions app/views/mercury/modals/character.html.haml

This file was deleted.

11 changes: 11 additions & 0 deletions app/views/mercury/modals/htmleditor.html.erb
@@ -0,0 +1,11 @@
<%= semantic_form_for 'htmlEditor', { :html => { :id => 'mercury_htmlEditor', :style => 'width:650px' } } do |f| %>

<textarea class="mercury-modal-pane-container" rows="5"></textarea>

<div class="mercury-modal-controls">
<%= f.buttons do %>
<%= f.commit_button 'Save and Replace' %>
<% end %>
</div>

<% end %>
8 changes: 0 additions & 8 deletions app/views/mercury/modals/htmleditor.html.haml

This file was deleted.

40 changes: 40 additions & 0 deletions app/views/mercury/modals/link.html.erb
@@ -0,0 +1,40 @@
<%= semantic_form_for 'link', { :html => { :id => 'mercury_link', style: 'width:600px' } } do |f| %>

<div class="mercury-modal-pane-container">
<div class="mercury-modal-pane">
<%= f.inputs :id => 'link_text_container' do %>
<%= f.input :text, :required => false, :label => 'Link Content' %>
<% end %>
<%= f.inputs 'Standard Links' do %>
<%= f.input :external_url, :required => false, :input_html => { :class => 'selectable' },
:label => '<input name="link_type" type="radio" value="external_url" checked="checked"/>URL'.html_safe %>
<% end %>
<%= f.inputs 'Index / Bookmark Links' do %>
<%= f.input :existing_bookmark, :as => :select, :required => false, :input_html => { :class => 'selectable' }, :include_blank => false,
:collection => [],
:label => '<input name="link_type" type="radio" value="existing_bookmark"/>Existing Links'.html_safe %>
<%= f.input :new_bookmark, :required => false, :input_html => { :class => 'selectable' },
:label => '<input name="link_type" type="radio" value="new_bookmark"/>Bookmark'.html_safe %>
<% end %>
<%= f.inputs 'Options' do %>
<%= f.input :target, :as => :select, :required => false, :include_blank => 'Self (the same window or tab)',
:collection => [['Blank (a new window or tab)', '_blank'], ['Top (removes any frames)', '_top'], ['Popup Window (javascript new window popup)', 'popup']],
:label => 'Link Target' %>
<div id="popup_options" class="link-target-options" style="display:none">
<%= f.input :popup_width, required: false, label: 'Popup Width' %>
<%= f.input :popup_height, required: false, label: 'Popup Height' %>
</div>
<% end %>
</div>
</div>

<div class="mercury-modal-controls">
<%= f.buttons do %>
<%= f.commit_button 'Insert Link' %>
<% end %>
</div>

<% end %>
31 changes: 0 additions & 31 deletions app/views/mercury/modals/link.html.haml

This file was deleted.

43 changes: 43 additions & 0 deletions app/views/mercury/modals/media.html.erb
@@ -0,0 +1,43 @@
<%= semantic_form_for 'media', { :html => { :id => 'mercury_media', :style => 'width:600px' } } do |f| %>

<div class="mercury-modal-pane-container">
<div class="mercury-modal-pane">
<%= f.inputs 'Images' do %>
<%= f.input :image_url, :required => false, :input_html => { :class => 'selectable' },
:label => '<input name="media_type" type="radio" value="image_url" checked="checked"/>URL'.html_safe %>
<% end %>
<%= f.inputs 'Videos' do %>
<%= f.input :youtube_url, :required => false, :input_html => { :class => 'selectable' },
:label => '<input name="media_type" type="radio" value="youtube_url"/>YouTube Share URL'.html_safe %>
<%= f.input :vimeo_url, :required => false, :input_html => { :class => 'selectable' },
:label => '<input name="media_type" type="radio" value="vimeo_url"/>Vimeo URL'.html_safe %>
<% end %>
<%= f.inputs 'Options' do %>
<div id="image_url" class="media-options">
<%= f.input :image_alignment, :as => :select, :required => false, :include_blank => 'None',
:collection => [['Left', 'left'], ['Right', 'right'], ['Top', 'top'], ['Middle', 'middle'], ['Bottom', 'bottom'], ['Absolute Middle', 'absmiddle'], ['Absolute Bottom', 'absbottom']],
:label => 'Alignment' %>
</div>

<div id="youtube_url" class="media-options" style="display:none">
<%= f.input :youtube_width, :required => false, :label => 'Width', :input_html => { :value => '560' } %>
<%= f.input :youtube_height, :required => false, :label => 'Height', :input_html => { :value => '349' } %>
</div>

<div id="vimeo_url" class="media-options" style="display:none">
<%= f.input :vimeo_width, :required => false, :label => 'Width', :input_html => { :value => '400' } %>
<%= f.input :vimeo_height, :required => false, :label => 'Height', :input_html => { :value => '225' } %>
</div>
<% end %>
</div>
</div>

<div class="mercury-modal-controls">
<%= f.buttons do %>
<%= f.commit_button 'Insert Media' %>
<% end %>
</div>

<% end %>
33 changes: 0 additions & 33 deletions app/views/mercury/modals/media.html.haml

This file was deleted.

5 changes: 5 additions & 0 deletions app/views/mercury/modals/sanitizer.html.erb
@@ -0,0 +1,5 @@
<div id="mercury_sanitizer" style="width:450px">
<div class="information">It looks like you've pasted directly from Microsoft Office!<br/><br/>Sadly though, your browser wasn't able to properly handle what you pasted. But that's ok, because I've sanitized it for you!</div>
<textarea rows="20" wrap="off"></textarea>
<strong>You can just copy and paste the sanitized content that appears above.</strong>
</div>
4 changes: 0 additions & 4 deletions app/views/mercury/modals/sanitizer.html.haml

This file was deleted.

66 changes: 66 additions & 0 deletions app/views/mercury/modals/table.html.erb
@@ -0,0 +1,66 @@
<%= semantic_form_for 'table', { :html => { :id => 'mercury_table', :style => 'width:700px' } } do |f| %>

<div class="mercury-modal-pane-container">
<div class="mercury-modal-pane">

<div id="table_display">
<table border="1" cellspacing="0">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</div>

<div id="table_options">
<%= f.inputs do %>
<li id="table_rows_input" class="select input optional">
<label for="table_rows">Rows</label>
<input type="button" class="action" value="Add Before" name="insertRowBefore"/>
<input type="button" class="action" value="Add After" name="insertRowAfter"/>
<input type="button" class="action" value="Remove" name="deleteRow"/>
</li>
<li id="table_columns_input" class="select input optional">
<label for="table_rows">Rows</label>
<input type="button" class="action" value="Add Before" name="insertColumnBefore"/>
<input type="button" class="action" value="Add After" name="insertColumnAfter"/>
<input type="button" class="action" value="Remove" name="deleteColumn"/>
</li>
<hr/>
<li id="table_row_adjust_input" class="select input optional">
<label for="table_row_adjust">Row Span</label>
<input type="button" class="action" value="+" name="increaseRowspan"/>
<input type="button" class="action" value="-" name="decreaseRowspan"/>
</li>
<li id="table_column_adjust_input" class="select input optional">
<label for="table_column_adjust">Column Span</label>
<input type="button" class="action" value="+" name="increaseColspan"/>
<input type="button" class="action" value="-" name="decreaseColspan"/>
</li>
<% end %>
<%= f.inputs 'Options' do %>
<%= f.input :alignment, :as => :select, :required => false, :include_blank => 'None',
:collection => [['Left', 'left'], ['Right', 'right']] %>
<%= f.input :border, :required => false, :input_html => { :value => 1 } %>
<%= f.input :spacing, :required => false, :input_html => { :value => 0 } %>
<% end %>
</div>

</div>
</div>

<div class="mercury-modal-controls">
<%= f.buttons do %>
<%= f.commit_button 'Insert Table' %>
<% end %>
</div>

<% end %>

0 comments on commit fda1545

Please sign in to comment.