[issue #133] Editor JS moved to separate file

This commit is contained in:
George Vinogradov 2012-02-09 04:35:07 +04:00
parent 2160f3aa66
commit a4baf8b670
3 changed files with 25 additions and 25 deletions

View File

@ -15,25 +15,12 @@
= link_to t("layout.cancel"), blob_file_path, :class => 'minibutton', :id => 'gollum-editor-preview' = link_to t("layout.cancel"), blob_file_path, :class => 'minibutton', :id => 'gollum-editor-preview'
:javascript :javascript
(function($) { $(function() {
$.Editor = function() { $.BlobEditor();
$.Editor.Placeholder.add($('#gollum-editor-edit-summary input')); });
$('#gollum-editor form[name="blob-editor"]').submit(function( e ) {
e.preventDefault();
$.Editor.Placeholder.clearAll();
//debug('submitting');
$(this).unbind('submit');
$(this).submit();
});
};
$.Editor.Placeholder = $.GollumPlaceholder;
$.Editor();
})(jQuery);
- content_for :javascripts do - content_for :javascripts do
= javascript_include_tag 'gollum/gollum.placeholder.js' = javascript_include_tag 'gollum/gollum.placeholder.js', 'blob.editor.js'
- content_for :stylesheets do - content_for :stylesheets do
= stylesheet_link_tag 'gollum/editor.css' = stylesheet_link_tag 'gollum/editor.css'

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120131124517) do ActiveRecord::Schema.define(:version => 20120131141651) do
create_table "arches", :force => true do |t| create_table "arches", :force => true do |t|
t.string "name", :null => false t.string "name", :null => false
@ -253,11 +253,11 @@ ActiveRecord::Schema.define(:version => 20120131124517) do
t.text "description" t.text "description"
t.string "ancestry" t.string "ancestry"
t.boolean "has_issues", :default => true t.boolean "has_issues", :default => true
t.boolean "has_wiki", :default => false
t.string "srpm_file_name" t.string "srpm_file_name"
t.string "srpm_content_type" t.string "srpm_content_type"
t.integer "srpm_file_size" t.integer "srpm_file_size"
t.datetime "srpm_updated_at" t.datetime "srpm_updated_at"
t.boolean "has_wiki", :default => false
end end
add_index "projects", ["category_id"], :name => "index_projects_on_category_id" add_index "projects", ["category_id"], :name => "index_projects_on_category_id"
@ -320,19 +320,18 @@ ActiveRecord::Schema.define(:version => 20120131124517) do
create_table "users", :force => true do |t| create_table "users", :force => true do |t|
t.string "name" t.string "name"
t.string "email", :default => "", :null => false t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "password_salt", :default => "", :null => false
t.string "reset_password_token" t.string "reset_password_token"
t.string "remember_token" t.datetime "reset_password_sent_at"
t.datetime "remember_created_at" t.datetime "remember_created_at"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.text "ssh_key" t.text "ssh_key"
t.string "uname" t.string "uname"
t.string "role" t.string "role"
t.string "language", :default => "en" t.string "language", :default => "en"
t.integer "own_projects_count", :default => 0, :null => false t.integer "own_projects_count", :default => 0, :null => false
end end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["email"], :name => "index_users_on_email", :unique => true

View File

@ -0,0 +1,14 @@
(function($) {
$.BlobEditor = function() {
$.BlobEditor.Placeholder.add($('#gollum-editor-edit-summary input'));
$('#gollum-editor form[name="blob-editor"]').submit(function( e ) {
e.preventDefault();
$.BlobEditor.Placeholder.clearAll();
//debug('submitting');
$(this).unbind('submit');
$(this).submit();
});
};
$.BlobEditor.Placeholder = $.GollumPlaceholder;
})(jQuery);