Skip to content

Commit

Permalink
updated for 0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
cristi committed Oct 13, 2009
1 parent 68ffbca commit 161c155
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 88 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ About

An extension by [Aissac][ai] that allows you to add custom fields to [Radiant CMS][rd] pages.

Test on Radiant 0.7.1 and 0.8.
Test on Radiant 0.7.1, 0.8 and 0.9 RC1.

Features
---
Expand All @@ -28,13 +28,6 @@ Then run the migration and the update:
rake radiant:extensions:custom_fields:migrate
rake radiant:extensions:custom_fields:update

###Note

To get the Radiant 0.7.1 version tag you need to:

cd vendor/extensions/custom_fields/
git checkout v0.7

Usage
---

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/admin/custom_fields_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::CustomFieldsController < ApplicationController

layout 'custom_fields'
before_filter :find_page
before_filter :attach_assets, :find_all_assignable_custom_fields, :only => [:index]
Expand Down Expand Up @@ -48,7 +47,8 @@ def find_all_assignable_custom_fields
end

def attach_assets
include_javascript "admin/custom_fields_iframe"
include_javascript "admin/prototype"
include_javascript "admin/custom_fields"
include_stylesheet "admin/custom_fields"
end
end
8 changes: 5 additions & 3 deletions app/views/admin/custom_fields/_custom_fields_popup.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
- content_for 'popups' do
#custom_fields.popup{:style => 'display:none'}
#custom_fields_busy.busy{:style => "display: none"}= image('spinner.gif', :alt => "")
%h3.title Custom Fields
#custom_fields_wrap
%IFRAME{:src => custom_fields_path(model),:id => "CFframe", :style => 'width:880px;height:400px;'}
%p
= link_to 'Close', "#", :class => 'close'
%IFRAME{:src => custom_fields_path(model),:id => "CFframe", :style => 'width:856px;height:400px;'}
%p.close_link=link_to_function "Close", "$(this).closePopup();"

4 changes: 2 additions & 2 deletions app/views/admin/custom_fields/_show_custom_fields.html.haml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#show_custom_fields
= link_to 'Show Custom Fields', '#', {:id => 'show_custom_fields_link'} unless model.new_record?
#show_custom_fields{ :style => "float:right;"}
%a.popup{ :href => "#custom_fields", :style => "display:block;text-decoration:none;color:black;border:1px solid rgb(0, 92, 157);line-height:20px;width:120px;cursor:pointer;margin:-13px 5px 0 5px;padding:5px 10px;font-size:80%;font-style:italic;background:white;" } Show Custom Fields
3 changes: 1 addition & 2 deletions app/views/admin/custom_fields/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
= show_flash_message
#cf
%h3 Custom fields:
#add_new_custom_field.clearfix
%a#and_new_custom_field_link{:href => '#'} Add new custom field
%a#add_new_custom_field_link{:href => '#'} Add new custom field
#add_new_custom_field_div{:style => 'display:none;'}
= render :partial => 'admin/custom_fields/new'
#index_custom_fields
Expand Down
3 changes: 1 addition & 2 deletions custom_fields_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ class CustomFieldsExtension < Radiant::Extension
def activate
Page.send(:include, CustomFields::PageExtensions)
Page.send(:include, CustomFields::CustomFieldsTags)
Admin::PagesController.class_eval { include CustomFields::AddAssets }

admin.page.edit.add :main, "admin/custom_fields/show_custom_fields", :before => "edit_header"
admin.page.edit.add :main, "admin/custom_fields/custom_fields_popup", :before => "edit_buttons"
admin.page.edit.add :popups, "admin/custom_fields/custom_fields_popup"
end

def deactivate
Expand Down
15 changes: 0 additions & 15 deletions lib/custom_fields/add_assets.rb

This file was deleted.

21 changes: 19 additions & 2 deletions public/javascripts/admin/custom_fields.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
Event.observe(window, 'load', function () {
Event.observe("show_custom_fields_link", 'click', function () {
$("custom_fields").show();
Event.observe('enter_new_custom_field', 'click', function () {
$$("select.select_name")[0].hide();
$("enter_new_custom_field").hide();
$$("input.tb_name")[0].show();
$("cancel_enter_new_custom_field").show();
});
Event.observe('cancel_enter_new_custom_field', 'click', function () {
$$("select.select_name")[0].show();
$("enter_new_custom_field").show();
$$("input.tb_name")[0].hide();
$("cancel_enter_new_custom_field").hide();
});
Event.observe('add_new_custom_field_link', 'click', function () {
$("add_new_custom_field_div").show();
$("add_new_custom_field_link").hide();
});
Event.observe('cancel_new_custom_field', 'click', function () {
$("add_new_custom_field_div").hide();
$("add_new_custom_field_link").show();
})
});
22 changes: 0 additions & 22 deletions public/javascripts/admin/custom_fields_iframe.js

This file was deleted.

30 changes: 0 additions & 30 deletions public/stylesheets/admin/custom_fields.css

This file was deleted.

75 changes: 75 additions & 0 deletions public/stylesheets/sass/admin/custom_fields.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
.clearfix:after
:content "."
:display block
:height 0
:clear both
:visibility hidden
.clearfix
:display inline-block
.clearfix
:display block

#custom_fields_wrap
:width 856px
:overflow auto
:background-color #FFF

#custom_fields iframe
:border none

table.cf_forms
:width 90%
:background-color #F9F9F9
:border 1px solid #DFDFDF
:margin 10px 0 0 5%

thead
:background-color #F1F1F1

th
:padding 3px 10px

tbody
td
:padding 10px 20px 5px 20px
:vertical-align top
td.cf_name
:width 30%
input, select, textarea
:width 100%
td.cf_value
:width 70%
input, select, textarea
:width 100%

td.cf_action
:padding 3px 20px
form
:float left
:margin 0 10px 0 0

textarea
:border 1px inset threedface

a.cf_links
:color #0066CC
:text-decoration none
:font-size 13px

#add_new_custom_field_link
:float right
:color #000
:margin-right 70px
:padding-left 15px
:background transparent url(/images/admin/plus.png) no-repeat left center
.flash
:padding 5px 0 5px 25px
:margin 0 50px 10px 50px
:font #003300
:border 2px solid #CCC
&.success
:background #FFF url(/images/admin/accept.png) no-repeat 5px 50%
&.error
:background #FFF url(/images/admin/exclamation.png) no-repeat 5px 50%
&.notice
:backgroun :#FFF url(/images/admin/warning.png) no-repeat 5px 50%

0 comments on commit 161c155

Please sign in to comment.