refinerycms-tip-of-the-day 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/tips_controller.rb +8 -0
- data/app/models/tip.rb +6 -0
- data/app/views/admin/tips/_form.html.erb +28 -0
- data/app/views/admin/tips/_sortable_list.html.erb +4 -0
- data/app/views/admin/tips/_tip.html.erb +17 -0
- data/app/views/admin/tips/edit.html.erb +1 -0
- data/app/views/admin/tips/index.html.erb +48 -0
- data/app/views/admin/tips/new.html.erb +1 -0
- data/config/locales/en.yml +14 -0
- data/config/routes.rb +6 -0
- data/db/migrate/create_tips.rb +17 -0
- data/db/seeds/tips.rb +4 -0
- data/lib/generators/refinerycms_tip_of_the_day_generator.rb +4 -0
- data/lib/refinerycms_tips.rb +27 -0
- data/lib/tasks/tips.rake +5 -0
- data/readme.md +10 -0
- metadata +80 -0
data/app/models/tip.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
<% form_for [:admin, @tip] do |f| -%>
|
2
|
+
<%= render :partial => "/shared/admin/error_messages", :locals => {
|
3
|
+
:object => @tip,
|
4
|
+
:include_object_name => true
|
5
|
+
} %>
|
6
|
+
|
7
|
+
<div class='field'>
|
8
|
+
<%= f.label :title -%>
|
9
|
+
<%= f.text_field :title, :class => 'larger widest' -%>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class='field'>
|
13
|
+
<%= f.label :published, 'Published?' %>
|
14
|
+
<%= f.check_box :published %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class='field'>
|
18
|
+
<%= f.label :content, 'Content' %>
|
19
|
+
<%= f.text_area :content, :class => 'wymeditor widest' %>
|
20
|
+
</div>
|
21
|
+
<%= render :partial => "/shared/admin/form_actions",
|
22
|
+
:locals => {
|
23
|
+
:f => f,
|
24
|
+
:continue_editing => false,
|
25
|
+
:delete_title => t('admin.tips.tip.delete'),
|
26
|
+
:delete_confirmation => t('shared.admin.delete.message', :title => @tip.title)
|
27
|
+
} %>
|
28
|
+
<% end -%>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(tip) -%>">
|
2
|
+
<span class='title'>
|
3
|
+
<%= tip.title %>
|
4
|
+
<span class="preview"> </span>
|
5
|
+
</span>
|
6
|
+
<span class='actions'>
|
7
|
+
<%= link_to refinery_icon_tag("application_edit.png"), edit_admin_tip_path(tip),
|
8
|
+
:title => t('.edit') %>
|
9
|
+
<%= link_to refinery_icon_tag("delete.png"), admin_tip_path(tip),
|
10
|
+
:class => "cancel confirm-delete",
|
11
|
+
:title => t('.delete'),
|
12
|
+
:'data-confirm' => t('shared.admin.delete.message',
|
13
|
+
:title => tip.title
|
14
|
+
),
|
15
|
+
:'data-method' => :delete %>
|
16
|
+
</span>
|
17
|
+
</li>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<div id='actions'>
|
2
|
+
<ul>
|
3
|
+
<li>
|
4
|
+
<%= render :partial => "/shared/admin/search",
|
5
|
+
:locals => {
|
6
|
+
:url => admin_tips_url
|
7
|
+
} %>
|
8
|
+
</li>
|
9
|
+
<li>
|
10
|
+
<%= link_to t('.create_new'), new_admin_tip_url,
|
11
|
+
:class => "add_icon" %>
|
12
|
+
</li>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<div id='records'>
|
16
|
+
<% if searching? %>
|
17
|
+
<h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
|
18
|
+
<% if @tips.any? %>
|
19
|
+
<%= will_paginate @tips, :previous_label => '«', :next_label => '»' %>
|
20
|
+
<ul>
|
21
|
+
<%= render :partial => "tip",
|
22
|
+
:collection => @tips %>
|
23
|
+
</ul>
|
24
|
+
<%= will_paginate @tips, :previous_label => '«', :next_label => '»' %>
|
25
|
+
<% else %>
|
26
|
+
<p><%= t('shared.admin.search.no_results') %></p>
|
27
|
+
<% end %>
|
28
|
+
<% else %>
|
29
|
+
<% if @tips.any? %>
|
30
|
+
<%= will_paginate @tips,
|
31
|
+
:previous_label => '«',
|
32
|
+
:next_label => '»' %>
|
33
|
+
<ul>
|
34
|
+
<%= render :partial => "tip",
|
35
|
+
:collection => @tips %>
|
36
|
+
</ul>
|
37
|
+
<%= will_paginate @tips,
|
38
|
+
:previous_label => '«',
|
39
|
+
:next_label => '»' %>
|
40
|
+
<% else %>
|
41
|
+
<p>
|
42
|
+
<strong>
|
43
|
+
<%= t('.no_items_yet') %>
|
44
|
+
</strong>
|
45
|
+
</p>
|
46
|
+
<% end %>
|
47
|
+
<% end %>
|
48
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
en:
|
2
|
+
plugins:
|
3
|
+
refinerycms_tips:
|
4
|
+
title: Tips
|
5
|
+
admin:
|
6
|
+
tips:
|
7
|
+
index:
|
8
|
+
create_new: Create a new Tip
|
9
|
+
sorry_no_results: Sorry! There are no results found.
|
10
|
+
no_items_yet: There are no Tips yet. Click "Create a new Tip" to add your first tip.
|
11
|
+
show:
|
12
|
+
details: Details
|
13
|
+
age: Created
|
14
|
+
|
data/config/routes.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateTips < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :tips do |t|
|
4
|
+
t.string :title
|
5
|
+
t.text :content
|
6
|
+
t.boolean :published
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :tips, :id
|
10
|
+
load(Rails.root.join('db', 'seeds', 'tips.rb'))
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
UserPlugin.destroy_all({:name => "Tips"})
|
15
|
+
drop_table :tips
|
16
|
+
end
|
17
|
+
end
|
data/db/seeds/tips.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'refinery'
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Tips
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
|
7
|
+
initializer "static assets" do |app|
|
8
|
+
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
9
|
+
end
|
10
|
+
|
11
|
+
config.after_initialize do
|
12
|
+
puts "Registering Tip of the Day Plugin"
|
13
|
+
Refinery::Plugin.register do |plugin|
|
14
|
+
plugin.name = "refinerycms_tips"
|
15
|
+
plugin.menu_match = /(admin|refinery)\/tips?$/
|
16
|
+
plugin.url = {:controller => '/admin/tips',:action => 'index'}
|
17
|
+
plugin.activity = {
|
18
|
+
:class => Tip,
|
19
|
+
:title => 'title',
|
20
|
+
:url_refix => 'edit'
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/tasks/tips.rake
ADDED
data/readme.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Tip of the Day engine for Refinery CMS.
|
2
|
+
|
3
|
+
## How to build this engine as a gem
|
4
|
+
|
5
|
+
cd vendor/gems/refinerycms-tip-of-the-day
|
6
|
+
gem build refinerycms-tip-of-the-day.gempspec
|
7
|
+
gem install refinerycms-tip-of-the-day.gem
|
8
|
+
|
9
|
+
# Sign up for a http://rubygems.org/ account and publish the gem
|
10
|
+
gem push pkg/refinerycms-tip-of-the-day.gem
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: refinerycms-tip-of-the-day
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Jonathan Baughn
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-10-12 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description:
|
22
|
+
email: jonathan@uitek.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- readme.md
|
29
|
+
files:
|
30
|
+
- readme.md
|
31
|
+
- lib/refinerycms_tips.rb
|
32
|
+
- lib/generators/refinerycms_tip_of_the_day_generator.rb
|
33
|
+
- lib/tasks/tips.rake
|
34
|
+
- app/models/tip.rb
|
35
|
+
- app/views/admin/tips/_form.html.erb
|
36
|
+
- app/views/admin/tips/_tip.html.erb
|
37
|
+
- app/views/admin/tips/new.html.erb
|
38
|
+
- app/views/admin/tips/edit.html.erb
|
39
|
+
- app/views/admin/tips/index.html.erb
|
40
|
+
- app/views/admin/tips/_sortable_list.html.erb
|
41
|
+
- app/controllers/admin/tips_controller.rb
|
42
|
+
- config/routes.rb
|
43
|
+
- config/locales/en.yml
|
44
|
+
- db/migrate/create_tips.rb
|
45
|
+
- db/seeds/tips.rb
|
46
|
+
has_rdoc: true
|
47
|
+
homepage: http://uitek.com
|
48
|
+
licenses: []
|
49
|
+
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options:
|
52
|
+
- --main
|
53
|
+
- readme.md
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
requirements: []
|
73
|
+
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 1.3.7
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: Provides tip of the day
|
79
|
+
test_files: []
|
80
|
+
|