-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plugins are now created by running the board_plugin generator.
- Loading branch information
Showing
16 changed files
with
209 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Creates a skeleton for your board plugin. | ||
|
||
Usage : | ||
script/generate board_plugin [pluginname] |
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,34 @@ | ||
class BoardPluginGenerator < Rails::Generator::NamedBase | ||
attr_reader :plugin_name | ||
def initialize(runtime_args, runtime_options = {}) | ||
super | ||
@plugin_name = file_name.underscore | ||
end | ||
|
||
def manifest | ||
@plugin_name = name | ||
record do |m| | ||
m.directory "vendor/plugins/#{@plugin_name}/" | ||
m.template "init.rb.erb", "vendor/plugins/#{@plugin_name}/init.rb" | ||
m.file "README", "vendor/plugins/#{@plugin_name}/REAMDE" | ||
|
||
m.directory "vendor/plugins/#{@plugin_name}/lib/" | ||
m.template "lib/helpers.rb.erb", "vendor/plugins/#{@plugin_name}/lib/#{@plugin_name}.rb" | ||
m.directory "vendor/plugins/#{@plugin_name}/lib/javascripts" | ||
m.directory "vendor/plugins/#{@plugin_name}/lib/stylesheets" | ||
m.directory "vendor/plugins/#{@plugin_name}/lib/views" | ||
m.file "lib/javascripts/javascripts.js", "vendor/plugins/#{@plugin_name}/lib/javascripts/#{@plugin_name}.js" | ||
m.file "lib/stylesheets/stylesheets.css", "vendor/plugins/#{@plugin_name}/lib/stylesheets/#{@plugin_name}.css" | ||
m.file "lib/views/_formfor_plugin.html.erb", "vendor/plugins/#{@plugin_name}/lib/views/_formfor_#{@plugin_name}.html.erb" | ||
m.file "lib/views/view.html.erb", "vendor/plugins/#{@plugin_name}/lib/views/#{@plugin_name}.html.erb" | ||
|
||
m.directory "vendor/plugins/#{@plugin_name}/test/" | ||
m.template "test/plugin_test.rb.erb", "vendor/plugins/#{@plugin_name}/test/#{@plugin_name}_test.rb" | ||
m.file "test/test_helper.rb", "vendor/plugins/#{@plugin_name}/test/test_helper.rb" | ||
|
||
m.directory "vendor/plugins/#{@plugin_name}/tasks/" | ||
m.template "tasks/plugin_tasks.rake.erb", "vendor/plugins/#{@plugin_name}/tasks/#{@plugin_name}_tasks.rake" | ||
|
||
end | ||
end | ||
end |
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,13 @@ | ||
Title | ||
==== | ||
|
||
Introduction goes here. | ||
|
||
|
||
Example | ||
======= | ||
|
||
Example goes here. | ||
|
||
|
||
Copyright (c) 2010 [name of plugin creator], released under the MIT license |
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,23 @@ | ||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
|
||
desc 'Default: run unit tests.' | ||
task :default => :test | ||
|
||
desc 'Test the feed plugin.' | ||
Rake::TestTask.new(:test) do |t| | ||
t.libs << 'lib' | ||
t.libs << 'test' | ||
t.pattern = 'test/**/*_test.rb' | ||
t.verbose = true | ||
end | ||
|
||
desc 'Generate documentation for the feed plugin.' | ||
Rake::RDocTask.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'Feed' | ||
rdoc.options << '--line-numbers' << '--inline-source' | ||
rdoc.rdoc_files.include('README') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end |
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 @@ | ||
ActionView::Base.send :include, <%= plugin_name.capitalize%> |
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,3 @@ | ||
module <%= plugin_name.capitalize %> | ||
#Your code goes here | ||
end |
1 change: 1 addition & 0 deletions
1
lib/generators/board_plugin/templates/lib/javascripts/javascripts.js
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 @@ | ||
//Your Javascript goes here |
1 change: 1 addition & 0 deletions
1
lib/generators/board_plugin/templates/lib/stylesheets/stylesheets.css
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 @@ | ||
/* You CSS goes here*/ |
6 changes: 6 additions & 0 deletions
6
lib/generators/board_plugin/templates/lib/views/_formfor_plugin.html.erb
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,6 @@ | ||
<% form_remote_tag :html => { :action => url_for(:controller => "griditems", :action =>"create_grid_item"), :id => "form_for"} do %> | ||
<!-- Your form goes here --> | ||
<%= hidden_field_tag "refresh_rate", "0" %> | ||
<%= submit_to_remote "create_grid_item", "Create", :url => {:action => "create_grid_item", :type => type}, :html => {:class => "create"} %> <br> | ||
<%= submit_to_remote "update_grid_item", "Update", :url => {:action => "update_grid_item", :type => type}, :html => {:class => "update"} %> | ||
<% end %> |
7 changes: 7 additions & 0 deletions
7
lib/generators/board_plugin/templates/lib/views/view.html.erb
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,7 @@ | ||
<!-- Your plugin view goes here --> | ||
|
||
<div class="ui-widget"> | ||
<div class="ui-widget-header"> | ||
<%= @parameters["title"] %> | ||
</div> | ||
</div> |
12 changes: 12 additions & 0 deletions
12
lib/generators/board_plugin/templates/tasks/plugin_tasks.rake.erb
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,12 @@ | ||
namespace :<%= plugin_name.to_sym%> do | ||
desc "Sync plugin files with Bernard-Board" | ||
task :sync do | ||
a = system "rsync -ruv vendor/plugins/<%= plugin_name %>/lib/views/* app/views/griditems/plugins/<%= plugin_name %>" | ||
a = system "rsync -ruv vendor/plugins/<%= plugin_name%>/lib/javascripts/* public/javascripts" | ||
if a == true | ||
system "echo '\n\nSync was successful!'" | ||
else | ||
system "echo '\n\nSync failed!" | ||
end | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
lib/generators/board_plugin/templates/test/plugin_test.rb.erb
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,8 @@ | ||
require 'test_helper' | ||
|
||
class <%=plugin_name%>Test < ActiveSupport::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
end | ||
end |
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,3 @@ | ||
require 'rubygems' | ||
require 'active_support' | ||
require 'active_support/test_case' |
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,55 @@ | ||
/* Feed plugin javascript functions | ||
Pieter Loubser | ||
October 2010 | ||
Version 0.8 | ||
*/ | ||
|
||
var lastTarget = ""; | ||
|
||
//Update feed item periodically. | ||
// - currently hardcoded at 10s. | ||
function update_feed(size){ | ||
jQuery('#feed0').show(); | ||
var feedSize = size; | ||
var currentFeed = 0; | ||
var container = null; | ||
var interval = setInterval(function(){ | ||
jQuery('.feed').hide(); | ||
jQuery('#feed' + currentFeed).show(); | ||
container = jQuery('#feed' + currentFeed).parent().parent(); | ||
//This deals with the sudden descruction of the item container | ||
//Implemented to handle delete from rightclick menu | ||
if(jQuery(container).attr("id") == null){ | ||
clearInterval(interval); | ||
} | ||
else{ | ||
resizeText(container, currentFeed); | ||
} | ||
|
||
if(currentFeed < feedSize -1){ | ||
currentFeed++; | ||
} | ||
else{ | ||
currentFeed = 0; | ||
} | ||
}, 10000); | ||
} | ||
|
||
//Resize feed story text to fit in container | ||
function resizeText(container, currentFeed){ | ||
var max = 12; //Default max font size. Might change. #Issue 6 | ||
jQuery('#feed-description' + currentFeed).wrapInner('<div id="fontfit' + currentFeed + '"></div>'); | ||
var dheight = jQuery(container).height() - jQuery('#feed-header' + currentFeed).height(); | ||
var cheight = jQuery("#fontfit" + currentFeed).height(); | ||
var fsize = ((jQuery('#feed-description' + currentFeed).css("font-size")).slice(0,-2))*1; | ||
while(cheight<dheight-jQuery(container).css("borderWidth").slice(0,-2)*2 && fsize<max) { | ||
fsize+=1; | ||
jQuery('#feed-description' + currentFeed).css("font-size",fsize+"px"); | ||
cheight = jQuery("#fontfit" + currentFeed).height(); | ||
} | ||
while(cheight>dheight-jQuery(container).css("borderWidth").slice(0,-2)*2 || fsize>max && fsize > 1) { | ||
fsize-=1; | ||
jQuery('#feed-description' + currentFeed).css("font-size",fsize+"px"); | ||
cheight = jQuery("#fontfit"+ currentFeed).height(); | ||
} | ||
} |
Binary file not shown.