-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
HaTrinh
authored and
HaTrinh
committed
Jul 14, 2010
1 parent
559363c
commit fc09f21
Showing
22 changed files
with
5,611 additions
and
31 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,30 @@ | ||
module ApplicationHelper | ||
|
||
def add_color_picker_lib() | ||
stylesheet_link_tag('colorpicker', :plugin => 'redmine_daily_todos') + | ||
javascript_include_tag('color_picker/prototype', :plugin => 'redmine_daily_todos') + | ||
javascript_include_tag('color_picker/scriptaculous', :plugin => 'redmine_daily_todos') + | ||
javascript_include_tag('color_picker/builder', :plugin => 'redmine_daily_todos') + | ||
javascript_include_tag('color_picker/effects', :plugin => 'redmine_daily_todos') + | ||
javascript_include_tag('color_picker/dragdrop', :plugin => 'redmine_daily_todos') + | ||
javascript_include_tag('color_picker/controls', :plugin => 'redmine_daily_todos') + | ||
javascript_include_tag('color_picker/slider', :plugin => 'redmine_daily_todos') + | ||
javascript_include_tag('color_picker/yahoo', :plugin => 'redmine_daily_todos') + | ||
javascript_include_tag('color_picker/colorpicker', :plugin => 'redmine_daily_todos') | ||
end | ||
|
||
def wikitoolbar_with_color_for(field_id, color_picker_text_id) | ||
url = "#{Redmine::Utils.relative_url_root}/help/wiki_syntax.html" | ||
|
||
help_link = l(:setting_text_formatting) + ': ' + | ||
link_to(l(:label_help), url, | ||
:onclick => "window.open(\"#{ url }\", \"\", \"resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\"); return false;") | ||
|
||
javascript_tag("var colorPickerTextId = '#{color_picker_text_id}';") + | ||
javascript_include_tag('jstoolbar/jstoolbar', :plugin => 'redmine_daily_todos') + | ||
javascript_include_tag('jstoolbar/textile', :plugin => 'redmine_daily_todos') + | ||
javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") + | ||
javascript_tag("var wikiToolbar = new jsToolBar($('#{field_id}')); wikiToolbar.setColorPickerTextId('#{color_picker_text_id}') ; wikiToolbar.setHelpLink('#{help_link}'); wikiToolbar.draw();") + | ||
javascript_tag("new Control.ColorPicker('#{color_picker_text_id}', { IMAGE_BASE : '/javascripts/color_picker/' });") | ||
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,101 @@ | ||
// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) | ||
// | ||
// See scriptaculous.js for full license. | ||
|
||
var Builder = { | ||
NODEMAP: { | ||
AREA: 'map', | ||
CAPTION: 'table', | ||
COL: 'table', | ||
COLGROUP: 'table', | ||
LEGEND: 'fieldset', | ||
OPTGROUP: 'select', | ||
OPTION: 'select', | ||
PARAM: 'object', | ||
TBODY: 'table', | ||
TD: 'table', | ||
TFOOT: 'table', | ||
TH: 'table', | ||
THEAD: 'table', | ||
TR: 'table' | ||
}, | ||
// note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, | ||
// due to a Firefox bug | ||
node: function(elementName) { | ||
elementName = elementName.toUpperCase(); | ||
|
||
// try innerHTML approach | ||
var parentTag = this.NODEMAP[elementName] || 'div'; | ||
var parentElement = document.createElement(parentTag); | ||
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 | ||
parentElement.innerHTML = "<" + elementName + "></" + elementName + ">"; | ||
} catch(e) {} | ||
var element = parentElement.firstChild || null; | ||
|
||
// see if browser added wrapping tags | ||
if(element && (element.tagName != elementName)) | ||
element = element.getElementsByTagName(elementName)[0]; | ||
|
||
// fallback to createElement approach | ||
if(!element) element = document.createElement(elementName); | ||
|
||
// abort if nothing could be created | ||
if(!element) return; | ||
|
||
// attributes (or text) | ||
if(arguments[1]) | ||
if(this._isStringOrNumber(arguments[1]) || | ||
(arguments[1] instanceof Array)) { | ||
this._children(element, arguments[1]); | ||
} else { | ||
var attrs = this._attributes(arguments[1]); | ||
if(attrs.length) { | ||
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 | ||
parentElement.innerHTML = "<" +elementName + " " + | ||
attrs + "></" + elementName + ">"; | ||
} catch(e) {} | ||
element = parentElement.firstChild || null; | ||
// workaround firefox 1.0.X bug | ||
if(!element) { | ||
element = document.createElement(elementName); | ||
for(attr in arguments[1]) | ||
element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; | ||
} | ||
if(element.tagName != elementName) | ||
element = parentElement.getElementsByTagName(elementName)[0]; | ||
} | ||
} | ||
|
||
// text, or array of children | ||
if(arguments[2]) | ||
this._children(element, arguments[2]); | ||
|
||
return element; | ||
}, | ||
_text: function(text) { | ||
return document.createTextNode(text); | ||
}, | ||
_attributes: function(attributes) { | ||
var attrs = []; | ||
for(attribute in attributes) | ||
attrs.push((attribute=='className' ? 'class' : attribute) + | ||
'="' + attributes[attribute].toString().escapeHTML() + '"'); | ||
return attrs.join(" "); | ||
}, | ||
_children: function(element, children) { | ||
if(typeof children=='object') { // array can hold nodes and text | ||
children.flatten().each( function(e) { | ||
if(typeof e=='object') | ||
element.appendChild(e) | ||
else | ||
if(Builder._isStringOrNumber(e)) | ||
element.appendChild(Builder._text(e)); | ||
}); | ||
} else | ||
if(Builder._isStringOrNumber(children)) | ||
element.appendChild(Builder._text(children)); | ||
}, | ||
_isStringOrNumber: function(param) { | ||
return(typeof param=='string' || typeof param=='number'); | ||
} | ||
} |
Oops, something went wrong.