Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 2966 Bytes
1 | class Admin::TextfiltersController < Admin::BaseController |
2 | def index |
3 | list |
4 | render_action 'list' |
5 | end |
6 | |
7 | def list |
8 | @textfilters = TextFilter.find(:all, :order => "id DESC") |
9 | @textfilter_map = TextFilter.filters_map |
10 | @macros = TextFilter.available_filters.select { |filter| TextFilterPlugin::Macro > filter } |
11 | end |
12 | |
13 | def show |
14 | @textfilter = TextFilter.find(params[:id]) |
15 | @textfilters = TextFilter.filters_map |
16 | @help_text = @textfilter.help |
17 | end |
18 | |
19 | def show_help |
20 | @textfilter = TextFilter.find(params[:id]) |
21 | @help_text = @textfilter.help |
22 | end |
23 | |
24 | def macro_help |
25 | @macro = TextFilter.available_filters.find { |filter| filter.short_name == params[:id] } |
26 | @help_text = BlueCloth.new(@macro.help_text).to_html |
27 | end |
28 | |
29 | def new |
30 | @textfilter = TextFilter.new(params[:textfilter]) |
31 | @textfilter.filters ||= [] |
32 | @textfilter.params ||= {} |
33 | |
34 | setup_defaults |
35 | |
36 | if request.post? |
37 | @textfilter.attributes = params[:textfilter] |
38 | if params.has_key?(:filter) |
39 | @textfilter.filters = params[:filter].keys.collect {|k| k.to_sym } |
40 | end |
41 | if request.post? and @textfilter.save |
42 | flash[:notice] = 'TextFilter was successfully updated.' |
43 | redirect_to :action => 'show', :id => @textfilter.id |
44 | end |
45 | end |
46 | end |
47 | |
48 | def edit |
49 | @textfilter = TextFilter.find(params[:id]) |
50 | |
51 | setup_defaults |
52 | |
53 | if request.post? |
54 | @textfilter.attributes = params[:textfilter] |
55 | if params.has_key?(:filter) |
56 | @textfilter.filters = params[:filter].keys.collect {|k| k.to_sym } |
57 | end |
58 | @textfilter.params = params[:params] |
59 | if request.post? and @textfilter.save |
60 | flash[:notice] = 'TextFilter was successfully updated.' |
61 | redirect_to :action => 'show', :id => @textfilter.id |
62 | end |
63 | end |
64 | end |
65 | |
66 | def destroy |
67 | @textfilter = TextFilter.find(params[:id]) |
68 | if request.post? |
69 | @textfilter.destroy |
70 | redirect_to :action => 'list' |
71 | end |
72 | end |
73 | |
74 | def preview |
75 | headers["Content-Type"] = "text/html; charset=utf-8" |
76 | @textfilter = params[:textfilter] |
77 | render :layout => false |
78 | end |
79 | |
80 | private |
81 | |
82 | def setup_defaults |
83 | types=TextFilter.available_filter_types |
84 | |
85 | @markup_options = types['markup'].collect {|f| [f.short_name, f.display_name]}.sort_by{|f| f[0]} |
86 | @postprocess_options = types['postprocess'].collect do |f| |
87 | [f.short_name, f.display_name, f.description, @textfilter.filters.include?(f.short_name.to_sym)] |
88 | end.sort_by {|f| f[0]} |
89 | |
90 | @filterparams = Hash.new |
91 | @filterdescriptions = Hash.new |
92 | @filterhelp = Hash.new |
93 | @filteroptions = Hash.new |
94 | |
95 | (types['macropre']+types['macropost']+types['postprocess']).each do |f| |
96 | f.default_config.each do |key,value| |
97 | @filterparams[key] = value[:default] |
98 | @filterdescriptions[key] = value[:description] |
99 | @filterhelp[key] = value[:help] |
100 | @filteroptions[key] = value[:options] |
101 | end |
102 | end |
103 | |
104 | @filterparams.update(@textfilter.params) |
105 | end |
106 | end |