formol 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -132
- data/app/assets/images/formol/icons/add.png +0 -0
- data/app/assets/images/formol/icons/application_add.png +0 -0
- data/app/assets/images/formol/icons/delete.png +0 -0
- data/app/assets/images/formol/icons/page_white_edit.png +0 -0
- data/app/assets/javascripts/formol/admin/categories.js.coffee +1 -0
- data/app/assets/javascripts/formol/posts.js.coffee +0 -2
- data/app/assets/javascripts/formol/topics.js.coffee +28 -31
- data/app/assets/javascripts/markitup/sets/bbcode/set.js +39 -0
- data/app/assets/javascripts/markitup/sets/markdown/set.js +3 -3
- data/app/assets/stylesheets/formol/admin.css.scss +146 -0
- data/app/assets/stylesheets/formol/posts.css.scss +0 -2
- data/app/assets/stylesheets/formol/topics.css.scss +1 -2
- data/app/assets/stylesheets/markitup/sets/bbcode/images/bold.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/clean.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/code.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/fonts.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/italic.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/link.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/list-bullet.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/list-item.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/list-numeric.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/picture.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/preview.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/quotes.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/stroke.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/images/underline.png +0 -0
- data/app/assets/stylesheets/markitup/sets/bbcode/style.css +47 -0
- data/app/models/formol/post_observer.rb +4 -0
- data/app/views/formol/admin/categories/_category.html.erb +13 -5
- data/app/views/formol/admin/categories/index.html.erb +4 -0
- data/app/views/formol/admin/forums/_forum.html.erb +2 -2
- data/app/views/formol/polls/_form.html.erb +5 -7
- data/config/locales/formol/views/admin/categories/en.yml +11 -0
- data/config/locales/formol/views/admin/forums/en.yml +7 -0
- data/config/locales/formol/views/polls/en.yml.yml +6 -1
- data/config/locales/formol/views/topics/en.yml +2 -1
- data/lib/formol.rb +18 -2
- data/lib/formol/config.rb +12 -1
- data/lib/formol/generators/install/install_generator.rb +3 -1
- data/lib/formol/generators/install/templates/initializer/formol.rb.erb +6 -3
- data/lib/formol/version.rb +1 -1
- data/lib/formol/view_helpers/assets_helper.rb +19 -2
- data/lib/formol_.rb +1 -3
- metadata +57 -12
data/README.md
CHANGED
@@ -1,49 +1,6 @@
|
|
1
1
|
# Formol
|
2
2
|
|
3
|
-
Formol is a Rails 3.1 forum engine until Rails 3.2 is out for good.
|
4
|
-
|
5
|
-
## Why an engine?
|
6
|
-
|
7
|
-
Because I needed it. And because a forum is rarely a standalone app in a professional context.
|
8
|
-
|
9
|
-
In a near future, formol engine will be packaged in an independent and standalone application for those who need it.
|
10
|
-
|
11
|
-
## Why writing a forum in rails?
|
12
|
-
|
13
|
-
Customers often ask for a forum inside their app. They think about phpBB or vBulletin like forum but it doesn't exist in rails.
|
14
|
-
Developping one is really too expensive for a single project and:
|
15
|
-
|
16
|
-
* bridge users between a phpBB and a rails app is very tricky (I just don't wanna try it).
|
17
|
-
* phpBB / vBulletin is hard (or impossible) to embed into an application layout, especially a rails one.
|
18
|
-
* Rails app and php forum won't share their sessions
|
19
|
-
|
20
|
-
## Why don't use an existing solution?
|
21
|
-
|
22
|
-
Existing solutions are:
|
23
|
-
|
24
|
-
* [Beast](https://github.com/courtenay/altered_beast)
|
25
|
-
* [Forem](https://github.com/radar/forem)
|
26
|
-
* [Rails3-forums](https://github.com/smholloway/Rails3-forum)
|
27
|
-
|
28
|
-
Beast has been inactive for 2 years. It's rails 2.2 and ruby 1.8. Don't need to say more.
|
29
|
-
|
30
|
-
Rails3-forums has been inactive for 8 months. It does less than formol after 1.5 weeks of development.
|
31
|
-
|
32
|
-
Forem is the most complete solution you can find in rails.
|
33
|
-
Unfortunatly, it doesn't suit my needs.
|
34
|
-
|
35
|
-
In addition, I had to "come back" to ruby (was programming Java for 1.5 year) and I've never written an engine, never used rails 3.1 for a real project.
|
36
|
-
|
37
|
-
I decided then to write my own, with the best test coverage I can get (actually 99.3%).
|
38
|
-
|
39
|
-
## Scaling
|
40
|
-
|
41
|
-
I do my best to think about everything that could make this engine scale for devils:
|
42
|
-
|
43
|
-
* every non 'eager-loadable' association (like first and last on has_many) is heavily cached with belongs_to.
|
44
|
-
* there's counters cache everywhere
|
45
|
-
* I'll introduce caching (or try to in any case) for very high scaling when the app is stable.
|
46
|
-
* I use a lot of indexes
|
3
|
+
Formol is a Rails 3.1 forum engine until Rails 3.2 is out for good. [read more...](https://github.com/mulasse/formol/wiki/00.Introducing-Formol)
|
47
4
|
|
48
5
|
## Compatibility
|
49
6
|
|
@@ -54,13 +11,11 @@ Actually, formol is only tested with following parameters:
|
|
54
11
|
* Ubuntu
|
55
12
|
* Mysql
|
56
13
|
|
57
|
-
When I would have read travis documentation, I'll test it on more platforms / db / rails versions (rails 3.2, ruby 1.9.3 & jruby, postgreSQL)
|
58
|
-
|
59
14
|
## Installation
|
60
15
|
|
61
16
|
You can now install formol as a gem.
|
62
17
|
|
63
|
-
To install 0.0.
|
18
|
+
To install 0.0.6 (actual gem pushed)
|
64
19
|
|
65
20
|
```ruby
|
66
21
|
#in your Gemfile
|
@@ -68,41 +23,13 @@ To install 0.0.4 (actual gem pushed)
|
|
68
23
|
gem 'formol'
|
69
24
|
```
|
70
25
|
|
71
|
-
|
72
|
-
|
73
|
-
```ruby
|
74
|
-
#in your Gemfile
|
75
|
-
|
76
|
-
gem 'formol', :git => 'https://github.com/mulasse/formol'
|
77
|
-
```
|
78
|
-
|
79
|
-
then, execute `rails g formol:install`
|
80
|
-
|
81
|
-
You could have an issue saying that you're call method 'user class' on nil. That's because I load an observer in Formol::Engine.
|
82
|
-
I have no solution against this at the moment. Every tip is welcome.
|
83
|
-
|
84
|
-
Once `formol:install` has run, you should do the following things:
|
85
|
-
|
86
|
-
* run `rake db:migrate`
|
87
|
-
* add `<%= include_formol_javascripts %>` and `<%= include_formol_stylesheets %>` in the head section of your application layout
|
88
|
-
* add `include Formol::Integration::User` in your `User` model
|
89
|
-
* add one or more text-formatter gems into your gemfile (actually, only 'formol-markdown')
|
90
|
-
* edit initializer file and change `config.text_formatter` if you want something else than markdown
|
91
|
-
|
92
|
-
Formol expect your 'User' model to provide a method/property called `display_name`.
|
93
|
-
If your model hasn't it already, create this method and return whatever you want (nickname, firstname + lastname ...)
|
94
|
-
|
95
|
-
If you want to use syntax-highlighting, add a `stylesheet_link_tag` with `pygments/one_of_pyments_stylesheets` as param in your application layout.
|
96
|
-
You can find all pygments stylesheets in `app/assets/pygments`. This will be improved in the future.
|
97
|
-
|
98
|
-
Formol relies on jquery, jquery-ui and jquery_ujs.
|
99
|
-
You should have them in your application.css or application layout.
|
26
|
+
then, run `rails g formol:install` (problem with observer solved in 0.0.6)
|
100
27
|
|
101
|
-
|
28
|
+
[more...](https://github.com/mulasse/formol/wiki/02.Install-&-configure)
|
102
29
|
|
103
30
|
NOTICE:
|
104
31
|
|
105
|
-
0.0
|
32
|
+
Until 1.0.0, Formol is unstable. Almost all functionalities are tested BUT application is not complete.
|
106
33
|
You should not use Formol in production for now.
|
107
34
|
|
108
35
|
## Features
|
@@ -142,66 +69,12 @@ You should not use Formol in production for now.
|
|
142
69
|
* gemspec
|
143
70
|
* basic style
|
144
71
|
|
145
|
-
## Help on avatars
|
146
|
-
|
147
|
-
If you provide your own system of avatar storage, you'll need to provide `avatar_url` in your User model.
|
148
|
-
|
149
|
-
An example, with paperclip:
|
150
|
-
|
151
|
-
```ruby
|
152
|
-
class User < ActiveRecord::Base
|
153
|
-
has_attached_file :avatar, :styles => { :thumb => '100x100>' }
|
154
|
-
|
155
|
-
def avatar_url
|
156
|
-
avatar.url(:thumb)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
```
|
160
|
-
|
161
|
-
Formol works well with 100x100 avatars (according to basic style)
|
162
|
-
|
163
|
-
NOTICE: formol will look first for `avatar_url`, then for `email` and then fallback to default avatar
|
164
|
-
|
165
72
|
## Preview
|
166
73
|
|
167
74
|
Find other screenshots in /previews
|
168
75
|
|
169
76
|
![Topic content](https://github.com/mulasse/formol/raw/master/preview/topic_show.png)
|
170
77
|
|
171
|
-
## Dependencies
|
172
|
-
|
173
|
-
At the moment, formol is independent from any auth system, but I still recommend [Devise](http://github.com/plataformatec/devise).
|
174
|
-
Formol is highly coupled with will_paginate, you can't use it without will_paginate.
|
175
|
-
|
176
|
-
Maybe I'll change this with something more flexible in the future.
|
177
|
-
It's not planned for the moment because I don't know other solutions than will_paginate.
|
178
|
-
|
179
|
-
Others:
|
180
|
-
|
181
|
-
* JavaScript
|
182
|
-
* [jQuery](http://jquery.com)
|
183
|
-
* Assets
|
184
|
-
* [Scss](http://sass-lang.com/)
|
185
|
-
* [CoffeeScript](http://coffeescript.org/)
|
186
|
-
* Rails
|
187
|
-
* [Will_paginate](https://github.com/mislav/will_paginate)
|
188
|
-
* [Formtastic](https://github.com/justinfrench/formtastic)
|
189
|
-
* [Attribute normalizer](https://github.com/mdeering/attribute_normalizer)
|
190
|
-
* [Pygment.rb](https://github.com/tmm1/pygments.rb)
|
191
|
-
* [Redcarpet](https://github.com/tanoku/redcarpet)
|
192
|
-
* [Ranked-model](https://github.com/harvesthq/ranked-model) #=> want to abandon it for something simpler like act_as_list but for rails 3
|
193
|
-
* [Default_value_for](https://github.com/FooBarWidget/default_value_for)
|
194
|
-
|
195
|
-
## Coming next
|
196
|
-
|
197
|
-
* Soft delete topics (i'm not sure now since all tests failed because soft deletion doesn't trigger destroy callbacks)
|
198
|
-
* Theme support
|
199
|
-
* Generator (devise views)
|
200
|
-
* Demo app
|
201
|
-
* Selenium tests
|
202
|
-
* More translations (french of course and more)
|
203
|
-
* Permissions management (by admin)
|
204
|
-
|
205
78
|
## Boring legal stuff
|
206
79
|
|
207
80
|
Copyright 2011 Florian DUTEY
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#= require lib/jquery.prevent_double_submit
|
2
2
|
#= require formol/subscriptions
|
3
|
-
#= require markitup/jquery.markitup.js
|
4
|
-
#= require markitup/sets/markdown/set.js
|
5
3
|
|
6
4
|
(($) ->
|
7
5
|
$ ->
|
@@ -22,33 +20,32 @@
|
|
22
20
|
poll_options = $('.answers li.input')
|
23
21
|
index = poll_options.length
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
false
|
23
|
+
$('a.add_poll_option').click ->
|
24
|
+
id_replacement = [/_(\d)_/, '_' + index + '_']
|
25
|
+
name_replacement = [/\[(\d)\]/, '[' + index + ']']
|
26
|
+
replacement_meth = String.prototype.replace
|
27
|
+
|
28
|
+
new_line = poll_options.eq(0).clone()
|
29
|
+
new_id = replacement_meth.apply(new_line.attr('id'), id_replacement)
|
30
|
+
|
31
|
+
new_line.attr('id', new_id)
|
32
|
+
|
33
|
+
new_line.insertBefore($(this).parent())
|
34
|
+
|
35
|
+
new_input = new_line.find('input')
|
36
|
+
|
37
|
+
new_id = replacement_meth.apply(new_input.attr('id'), id_replacement)
|
38
|
+
new_name = replacement_meth.apply(new_input.attr('name'), name_replacement)
|
39
|
+
|
40
|
+
new_input.attr('id', new_id)
|
41
|
+
new_input.attr('name', new_name)
|
42
|
+
new_input.val('')
|
43
|
+
|
44
|
+
new_label = new_line.find('label')
|
45
|
+
|
46
|
+
new_label.attr('for', new_id)
|
47
|
+
|
48
|
+
index += 1
|
49
|
+
|
50
|
+
false
|
54
51
|
)(jQuery)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// ----------------------------------------------------------------------------
|
2
|
+
// markItUp!
|
3
|
+
// ----------------------------------------------------------------------------
|
4
|
+
// Copyright (C) 2008 Jay Salvat
|
5
|
+
// http://markitup.jaysalvat.com/
|
6
|
+
// ----------------------------------------------------------------------------
|
7
|
+
// BBCode tags example
|
8
|
+
// http://en.wikipedia.org/wiki/Bbcode
|
9
|
+
// ----------------------------------------------------------------------------
|
10
|
+
// Feel free to add more tags
|
11
|
+
// ----------------------------------------------------------------------------
|
12
|
+
mySettings = {
|
13
|
+
previewParserPath: '', // path to your BBCode parser
|
14
|
+
markupSet: [
|
15
|
+
{name:'Bold', key:'B', openWith:'[b]', closeWith:'[/b]'},
|
16
|
+
{name:'Italic', key:'I', openWith:'[i]', closeWith:'[/i]'},
|
17
|
+
{name:'Underline', key:'U', openWith:'[u]', closeWith:'[/u]'},
|
18
|
+
{separator:'---------------' },
|
19
|
+
{name:'Picture', key:'P', replaceWith:'[img][![Url]!][/img]'},
|
20
|
+
{name:'Link', key:'L', openWith:'[url=[![Url]!]]', closeWith:'[/url]', placeHolder:'Your text to link here...'},
|
21
|
+
{separator:'---------------' },
|
22
|
+
{name:'Size', key:'S', openWith:'[size=[![Text size]!]]', closeWith:'[/size]',
|
23
|
+
dropMenu :[
|
24
|
+
{name:'Big', openWith:'[size=200]', closeWith:'[/size]' },
|
25
|
+
{name:'Normal', openWith:'[size=100]', closeWith:'[/size]' },
|
26
|
+
{name:'Small', openWith:'[size=50]', closeWith:'[/size]' }
|
27
|
+
]},
|
28
|
+
{separator:'---------------' },
|
29
|
+
{name:'Bulleted list', openWith:'[list]\n', closeWith:'\n[/list]'},
|
30
|
+
{name:'Numeric list', openWith:'[list=[![Starting number]!]]\n', closeWith:'\n[/list]'},
|
31
|
+
{name:'List item', openWith:'[*] '},
|
32
|
+
{separator:'---------------' },
|
33
|
+
{name:'Quotes', openWith:'[quote]', closeWith:'[/quote]'},
|
34
|
+
{name:'Code', openWith:'[code=[![Language]!]]', closeWith:'[/code]'},
|
35
|
+
{separator:'---------------' },
|
36
|
+
{name:'Clean', className:"clean", replaceWith:function(markitup) { return markitup.selection.replace(/\[(.*?)\]/g, "") } }//,
|
37
|
+
//{name:'Preview', className:"preview", call:'preview' }
|
38
|
+
]
|
39
|
+
}
|
@@ -34,9 +34,9 @@ mySettings = {
|
|
34
34
|
{separator:'---------------'},
|
35
35
|
{name:'Quotes', openWith:'> '},
|
36
36
|
{name:'Code Block', openBlockWith:'```[![Language]!]\n', closeBlockWith:'\n```', multiline: false },
|
37
|
-
{name:'Code', openWith: '`', closeWith: '`' }
|
38
|
-
{separator:'---------------'},
|
39
|
-
{name:'Preview', call:'preview', className:"preview"}
|
37
|
+
{name:'Code', openWith: '`', closeWith: '`' }//,
|
38
|
+
//{separator:'---------------'},
|
39
|
+
//{name:'Preview', call:'preview', className:"preview"}
|
40
40
|
]
|
41
41
|
}
|
42
42
|
|
@@ -0,0 +1,146 @@
|
|
1
|
+
ul, ol {
|
2
|
+
list-style-type: none;
|
3
|
+
padding: 0;
|
4
|
+
}
|
5
|
+
|
6
|
+
.categories_tools {
|
7
|
+
li {
|
8
|
+
display: inline-block;
|
9
|
+
font-family: Arial, Helvetica, sans-serif;
|
10
|
+
font-size: 14px;
|
11
|
+
padding: 7px 10px;
|
12
|
+
background: -moz-linear-gradient(
|
13
|
+
top,
|
14
|
+
#ffffff 0%,
|
15
|
+
#b5b5b5);
|
16
|
+
background: -webkit-gradient(
|
17
|
+
linear, left top, left bottom,
|
18
|
+
from(#ffffff),
|
19
|
+
to(#b5b5b5));
|
20
|
+
border-radius: 5px;
|
21
|
+
-moz-border-radius: 5px;
|
22
|
+
-webkit-border-radius: 5px;
|
23
|
+
border: 1px solid #949494;
|
24
|
+
-moz-box-shadow:
|
25
|
+
0px 1px 3px rgba(000,000,000,0.5),
|
26
|
+
inset 0px 0px 2px rgba(255,255,255,1);
|
27
|
+
-webkit-box-shadow:
|
28
|
+
0px 1px 3px rgba(000,000,000,0.5),
|
29
|
+
inset 0px 0px 2px rgba(255,255,255,1);
|
30
|
+
text-shadow:
|
31
|
+
0px -1px 0px rgba(000,000,000,0.2),
|
32
|
+
0px 1px 0px rgba(255,255,255,1);
|
33
|
+
|
34
|
+
&:first-letter {
|
35
|
+
text-transform: capitalize;
|
36
|
+
}
|
37
|
+
|
38
|
+
a {
|
39
|
+
color: #050505;
|
40
|
+
text-decoration: none;
|
41
|
+
}
|
42
|
+
|
43
|
+
&.new a {
|
44
|
+
padding-left: 20px;
|
45
|
+
background: transparent url(icons/add.png) no-repeat scroll left top;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
.formol_categories {
|
51
|
+
width: 700px;
|
52
|
+
|
53
|
+
.formol_category > .label {
|
54
|
+
cursor: move;
|
55
|
+
background-color: #FFFBD3;
|
56
|
+
border-left: 3px solid yellow;
|
57
|
+
padding: 3px 6px;
|
58
|
+
}
|
59
|
+
|
60
|
+
li {
|
61
|
+
position: relative;
|
62
|
+
}
|
63
|
+
|
64
|
+
.actions {
|
65
|
+
display: none;
|
66
|
+
position: absolute;
|
67
|
+
right: 5px;
|
68
|
+
top: 5px;
|
69
|
+
z-index: 100;
|
70
|
+
padding: 0;
|
71
|
+
|
72
|
+
li {
|
73
|
+
display: inline-block;
|
74
|
+
height: 16px;
|
75
|
+
|
76
|
+
a {
|
77
|
+
float: left;
|
78
|
+
height: 16px;
|
79
|
+
width: 16px;
|
80
|
+
background-attachment: scroll;
|
81
|
+
background-color: transparent;
|
82
|
+
background-repeat: no-repeat;
|
83
|
+
background-position: top left;
|
84
|
+
color: transparent;
|
85
|
+
font-size: 0;
|
86
|
+
}
|
87
|
+
|
88
|
+
&.edit {
|
89
|
+
background-image: url(icons/page_white_edit.png);
|
90
|
+
}
|
91
|
+
|
92
|
+
&.destroy a {
|
93
|
+
background-image: url(icons/delete.png);
|
94
|
+
}
|
95
|
+
|
96
|
+
&.new_forum a {
|
97
|
+
background-image: url(icons/application_add.png);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
.label:hover,
|
103
|
+
.formol_forum:hover {
|
104
|
+
.actions {
|
105
|
+
display: inline-block;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
.formol_category_forums {
|
110
|
+
padding: 5px 10px;
|
111
|
+
padding-right: 0;
|
112
|
+
|
113
|
+
.ui-state-highlight {
|
114
|
+
height: 1.5em;
|
115
|
+
border: 1px dashed orange;
|
116
|
+
visibility: visible;
|
117
|
+
background-color: #ffee96;
|
118
|
+
}
|
119
|
+
|
120
|
+
.empty {
|
121
|
+
text-align: center;
|
122
|
+
background-color: #eee;
|
123
|
+
color: #aaa;
|
124
|
+
border-left: 3px solid #aaa;
|
125
|
+
border-bottom: 1px solid #aaa;
|
126
|
+
}
|
127
|
+
|
128
|
+
.formol_forum {
|
129
|
+
background-color: #dbffb4;
|
130
|
+
border-left: 4px solid #65C400;
|
131
|
+
border-bottom: 1px solid #65C400;
|
132
|
+
padding: 3px;
|
133
|
+
margin: 2px 0;
|
134
|
+
cursor: move;
|
135
|
+
|
136
|
+
> div {
|
137
|
+
display: inline-block;
|
138
|
+
}
|
139
|
+
|
140
|
+
.description {
|
141
|
+
color: #aaa;
|
142
|
+
font-style: italic;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/* -------------------------------------------------------------------
|
2
|
+
// markItUp!
|
3
|
+
// By Jay Salvat - http://markitup.jaysalvat.com/
|
4
|
+
// ------------------------------------------------------------------*/
|
5
|
+
.markItUp .markItUpButton1 a {
|
6
|
+
background-image:url(images/bold.png);
|
7
|
+
}
|
8
|
+
.markItUp .markItUpButton2 a {
|
9
|
+
background-image:url(images/italic.png);
|
10
|
+
}
|
11
|
+
.markItUp .markItUpButton3 a {
|
12
|
+
background-image:url(images/underline.png);
|
13
|
+
}
|
14
|
+
|
15
|
+
.markItUp .markItUpButton4 a {
|
16
|
+
background-image:url(images/picture.png);
|
17
|
+
}
|
18
|
+
.markItUp .markItUpButton5 a {
|
19
|
+
background-image:url(images/link.png);
|
20
|
+
}
|
21
|
+
|
22
|
+
.markItUp .markItUpButton6 a {
|
23
|
+
background-image:url(images/fonts.png);
|
24
|
+
}
|
25
|
+
.markItUp .markItUpButton7 a {
|
26
|
+
background-image:url(images/list-bullet.png);
|
27
|
+
}
|
28
|
+
.markItUp .markItUpButton8 a {
|
29
|
+
background-image:url(images/list-numeric.png);
|
30
|
+
}
|
31
|
+
.markItUp .markItUpButton9 a {
|
32
|
+
background-image:url(images/list-item.png);
|
33
|
+
}
|
34
|
+
|
35
|
+
.markItUp .markItUpButton10 a {
|
36
|
+
background-image:url(images/quotes.png);
|
37
|
+
}
|
38
|
+
.markItUp .markItUpButton11 a {
|
39
|
+
background-image:url(images/code.png);
|
40
|
+
}
|
41
|
+
|
42
|
+
.markItUp .clean a {
|
43
|
+
background-image:url(images/clean.png);
|
44
|
+
}
|
45
|
+
.markItUp .preview a {
|
46
|
+
background-image:url(images/preview.png);
|
47
|
+
}
|
@@ -1,5 +1,9 @@
|
|
1
1
|
module Formol
|
2
2
|
class PostObserver < ActiveRecord::Observer
|
3
|
+
def self.instance
|
4
|
+
super if Formol.config && Formol.config.user_class
|
5
|
+
end
|
6
|
+
|
3
7
|
def after_create(post)
|
4
8
|
post.topic.subscribers.each do |subscriber|
|
5
9
|
SubscriptionMailer.topic_reply(post, subscriber).deliver
|
@@ -1,9 +1,17 @@
|
|
1
1
|
<%= content_tag_for(:li, category) do %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
<div class="label">
|
3
|
+
<%= category.label %>
|
4
|
+
<ul class="actions">
|
5
|
+
<li class="new_forum"><%= link_to t('.new_forum'), new_admin_category_forum_path(category) %></li>
|
6
|
+
<li class="edit"><%= link_to t('.edit'), edit_admin_category_path(category) %></li>
|
7
|
+
<li class="destroy"><%= link_to t('.destroy'), [:admin, category], :method => :delete %></li>
|
8
|
+
</ul>
|
9
|
+
</div>
|
6
10
|
<ol class="formol_category_forums" id="formol_category_<%= category.id %>_forums">
|
7
|
-
|
11
|
+
<% if category.forums.blank? %>
|
12
|
+
<li class="empty">no forums</li>
|
13
|
+
<% else %>
|
14
|
+
<%= render category.forums, :category => category %>
|
15
|
+
<% end %>
|
8
16
|
</ol>
|
9
17
|
<% end %>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%= forum.description %>
|
7
7
|
</div>
|
8
8
|
<ul class="actions">
|
9
|
-
<li><%= link_to t('.edit_forum'), edit_admin_category_forum_path(category, forum) %></li>
|
10
|
-
<li><%= link_to t('.destroy_forum'), admin_category_forum_path(category, forum), :method => :delete %></li>
|
9
|
+
<li class="edit"><%= link_to t('.edit_forum'), edit_admin_category_forum_path(category, forum) %></li>
|
10
|
+
<li class="destroy"><%= link_to t('.destroy_forum'), admin_category_forum_path(category, forum), :method => :delete %></li>
|
11
11
|
</ul>
|
12
12
|
<% end %>
|
@@ -3,12 +3,10 @@
|
|
3
3
|
<%= form.input :duration %>
|
4
4
|
<%= form.input :max_options %>
|
5
5
|
|
6
|
-
|
7
|
-
<%= form.
|
8
|
-
<%= form
|
9
|
-
<%= render 'formol/poll/options/form', :form => option_form %>
|
10
|
-
<% end %>
|
6
|
+
<%= form.inputs :name => t('.answers'), :class => 'inputs answers' do %>
|
7
|
+
<%= form.semantic_fields_for :options do |option_form| %>
|
8
|
+
<%= render 'formol/poll/options/form', :form => option_form %>
|
11
9
|
<% end %>
|
12
|
-
<
|
13
|
-
|
10
|
+
<li class="helpers_add"><%= link_to '[+]', '#', :class => 'add_poll_option', :title => t('.add_poll_options') %></li>
|
11
|
+
<% end %>
|
14
12
|
<% end %>
|
data/lib/formol.rb
CHANGED
@@ -2,13 +2,16 @@
|
|
2
2
|
require 'formol_'
|
3
3
|
|
4
4
|
module Formol
|
5
|
-
mattr_reader
|
6
|
-
mattr_reader
|
5
|
+
mattr_reader :config
|
6
|
+
mattr_reader :formatters
|
7
|
+
mattr_reader :pygment_stylesheets
|
7
8
|
|
8
9
|
@@formatters = {}
|
9
10
|
|
10
11
|
class << self
|
11
12
|
def configure(&block)
|
13
|
+
load_pygment_stylesheets
|
14
|
+
|
12
15
|
@@config = Config.new
|
13
16
|
|
14
17
|
class_eval &block
|
@@ -21,6 +24,15 @@ module Formol
|
|
21
24
|
|
22
25
|
private
|
23
26
|
|
27
|
+
# load pygment stylesheets
|
28
|
+
def load_pygment_stylesheets
|
29
|
+
assets_stylesheets = File.join(File.expand_path('../../app/assets/stylesheets/pygments', __FILE__), '**', '*.css')
|
30
|
+
|
31
|
+
@@pygment_stylesheets = Dir[assets_stylesheets].collect do |s|
|
32
|
+
s.split('/').last.split('.css').first.to_sym
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
24
36
|
# load formol libs located inside main app
|
25
37
|
def load_formol_libs
|
26
38
|
Dir[Rails.root.join('lib', 'formol', '**', '*.rb')].each do |f|
|
@@ -64,6 +76,10 @@ end
|
|
64
76
|
|
65
77
|
require 'formol/engine'
|
66
78
|
|
79
|
+
# here and not in 'formol_.rb' because it requires Formol module to have @@formatters
|
80
|
+
require 'formol-markdown'
|
81
|
+
require 'formol-bbcode'
|
82
|
+
|
67
83
|
ActionController::Base.send(:include, Formol::Controllers::Auth)
|
68
84
|
ActionController::Base.send(:include, Formol::Permissions::Controllers)
|
69
85
|
|
data/lib/formol/config.rb
CHANGED
@@ -4,7 +4,8 @@ module Formol
|
|
4
4
|
:formatter,
|
5
5
|
:email_from,
|
6
6
|
:text_formatter,
|
7
|
-
:default_avatar
|
7
|
+
:default_avatar,
|
8
|
+
:default_pygment_theme)
|
8
9
|
|
9
10
|
def user
|
10
11
|
@user ||= user_class.constantize
|
@@ -13,5 +14,15 @@ module Formol
|
|
13
14
|
def default_avatar
|
14
15
|
@default_avatar || 'formol/default_avatar.png'
|
15
16
|
end
|
17
|
+
|
18
|
+
def default_pygment_theme
|
19
|
+
@default_pygment_theme || :pastie
|
20
|
+
end
|
21
|
+
|
22
|
+
def default_pygment_theme=(theme)
|
23
|
+
raise "pygments theme '#{theme}' does not exists. Please provide one of the following list:\n#{Formol.pygment_stylesheets.join(', ')}" unless Formol.pygment_stylesheets.include?(theme.to_sym)
|
24
|
+
|
25
|
+
@default_pygment_theme = theme
|
26
|
+
end
|
16
27
|
end
|
17
28
|
end
|
@@ -61,11 +61,13 @@ You can access it with http://yourhost/forums
|
|
61
61
|
What you need to do if you wanna formol work:
|
62
62
|
|
63
63
|
* run 'rake db:migrate'
|
64
|
-
* add '<%= include_formol_javascripts %>' in the head section of your application layout
|
64
|
+
* add '<%= include_formol_javascripts %>' and '<%= include_formol_stylesheets %>' in the head section of your application layout
|
65
65
|
* add 'include Formol::Integration::User' in your #{user_class} model
|
66
66
|
|
67
67
|
If you want to change where the forums are located, just change the "forums" path in 'config/routes.rb'.
|
68
68
|
|
69
|
+
By default, Formol will use markdown as text formatting language. You can change it in 'config/initializer/formol.rb' (other option is :bbcode)
|
70
|
+
|
69
71
|
Formol is delivered with no warranty under MIT license.
|
70
72
|
However, if you have any question, suggestion or issue, you can post them on our github repository, at the following address: https://github.com/mulasse/formol/issues
|
71
73
|
|
@@ -8,9 +8,7 @@ Formol.configure do
|
|
8
8
|
# usually, helper method is called 'current_user'
|
9
9
|
config.current_user_helper_method = :<%= current_user_helper %>
|
10
10
|
|
11
|
-
# choose what text formatter you need
|
12
|
-
# actually only :markdown is available
|
13
|
-
# we will add :bbcode in a near future
|
11
|
+
# choose what text formatter you need (:bbcode or :markdown)
|
14
12
|
config.text_formatter = :markdown
|
15
13
|
|
16
14
|
# you need to provide an email adress wich will be used as sender adress in all
|
@@ -25,4 +23,9 @@ Formol.configure do
|
|
25
23
|
# If you wanna change it, uncomment the following line
|
26
24
|
# you can set a relative path as you used it in image_tag() or an absolute path
|
27
25
|
# config.default_avatar = 'formol/default_avatar.png'
|
26
|
+
|
27
|
+
# change default pygment theme (syntax highlighting)
|
28
|
+
# if you don't provide a pygment_theme, :pastie will be used as default
|
29
|
+
# you can choose one in [:autumn, :borland, :bw, :colorful, :default, :emacs, :friendly, :fruity, :manni, :murphy, :native, :pastie, :perldoc, :tango, :trac, :vim, :vs]
|
30
|
+
# config.default_pygment_theme = :pastie
|
28
31
|
end
|
data/lib/formol/version.rb
CHANGED
@@ -3,14 +3,31 @@ module Formol
|
|
3
3
|
module AssetsHelper
|
4
4
|
def include_formol_javascripts
|
5
5
|
path = controller.controller_path
|
6
|
+
|
7
|
+
return unless path.start_with?('formol')
|
8
|
+
|
9
|
+
js_files = []
|
10
|
+
|
11
|
+
js_files << "markitup/jquery.markitup.js"
|
12
|
+
js_files << "markitup/sets/#{Formol.config.text_formatter}/set.js"
|
13
|
+
js_files << path
|
6
14
|
|
7
|
-
javascript_include_tag
|
15
|
+
js_files.collect{ |j| javascript_include_tag j }.join("\n").html_safe
|
8
16
|
end
|
9
17
|
|
10
18
|
def include_formol_stylesheets
|
11
19
|
path = controller.controller_path
|
12
20
|
|
13
|
-
|
21
|
+
return unless path.start_with?('formol')
|
22
|
+
|
23
|
+
stylesheets = []
|
24
|
+
|
25
|
+
stylesheets << "pygments/#{Formol.config.default_pygment_theme}"
|
26
|
+
stylesheets << "markitup/skins/simple/style"
|
27
|
+
stylesheets << "markitup/sets/#{Formol.config.text_formatter}/style"
|
28
|
+
stylesheets << (path.start_with?('formol/admin') ? "formol/admin" : path)
|
29
|
+
|
30
|
+
stylesheets.collect{ |s| stylesheet_link_tag s }.join("\n").html_safe
|
14
31
|
end
|
15
32
|
end
|
16
33
|
end
|
data/lib/formol_.rb
CHANGED
@@ -4,10 +4,8 @@ require 'attribute_normalizer'
|
|
4
4
|
require 'will_paginate'
|
5
5
|
require 'ranked-model'
|
6
6
|
require 'default_value_for'
|
7
|
-
require 'pygments.rb'
|
8
|
-
require 'redcarpet'
|
9
7
|
|
10
8
|
#libs
|
11
9
|
%w(config controllers formatters generators integration permissions rails view_helpers will_paginate).each do |lib|
|
12
10
|
require "formol/#{lib}"
|
13
|
-
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-19 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: formtastic
|
16
|
-
requirement: &
|
16
|
+
requirement: &74971140 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *74971140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: attribute_normalizer
|
27
|
-
requirement: &
|
27
|
+
requirement: &74967900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *74967900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: will_paginate
|
38
|
-
requirement: &
|
38
|
+
requirement: &74960560 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '3.0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *74960560
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: ranked-model
|
49
|
-
requirement: &
|
49
|
+
requirement: &74958950 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *74958950
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: default_value_for
|
60
|
-
requirement: &
|
60
|
+
requirement: &74956910 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,29 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *74956910
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: formol-markdown
|
71
|
+
requirement: &74955210 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.0.1
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *74955210
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: formol-bbcode
|
82
|
+
requirement: &74954420 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.0.1
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *74954420
|
69
91
|
description: Formol is a forum engine for rails 3.1. It provides most of common features
|
70
92
|
you can wait from a forum.
|
71
93
|
email:
|
@@ -77,6 +99,10 @@ files:
|
|
77
99
|
- app/assets/images/formol/default_avatar.png
|
78
100
|
- app/assets/images/formol/unread.png
|
79
101
|
- app/assets/images/formol/read.png
|
102
|
+
- app/assets/images/formol/icons/add.png
|
103
|
+
- app/assets/images/formol/icons/application_add.png
|
104
|
+
- app/assets/images/formol/icons/page_white_edit.png
|
105
|
+
- app/assets/images/formol/icons/delete.png
|
80
106
|
- app/assets/stylesheets/formol/topics.css.scss
|
81
107
|
- app/assets/stylesheets/formol/categories.css.scss
|
82
108
|
- app/assets/stylesheets/formol/forums.css.scss
|
@@ -89,6 +115,7 @@ files:
|
|
89
115
|
- app/assets/stylesheets/formol/partials/posts/post.css.scss
|
90
116
|
- app/assets/stylesheets/formol/partials/polls/poll.css.scss
|
91
117
|
- app/assets/stylesheets/formol/partials/breadcrumb.css.scss
|
118
|
+
- app/assets/stylesheets/formol/admin.css.scss
|
92
119
|
- app/assets/stylesheets/formol/mixins/after_clear.css.scss
|
93
120
|
- app/assets/stylesheets/formol/development.css
|
94
121
|
- app/assets/stylesheets/markitup/skins/markitup/images/bg-editor-markdown.png
|
@@ -109,6 +136,21 @@ files:
|
|
109
136
|
- app/assets/stylesheets/markitup/skins/simple/images/submenu.png
|
110
137
|
- app/assets/stylesheets/markitup/skins/simple/images/menu.png
|
111
138
|
- app/assets/stylesheets/markitup/skins/simple/style.css
|
139
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/clean.png
|
140
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/list-bullet.png
|
141
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/quotes.png
|
142
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/italic.png
|
143
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/stroke.png
|
144
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/fonts.png
|
145
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/preview.png
|
146
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/list-numeric.png
|
147
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/underline.png
|
148
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/picture.png
|
149
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/code.png
|
150
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/link.png
|
151
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/list-item.png
|
152
|
+
- app/assets/stylesheets/markitup/sets/bbcode/images/bold.png
|
153
|
+
- app/assets/stylesheets/markitup/sets/bbcode/style.css
|
112
154
|
- app/assets/stylesheets/markitup/sets/markdown/images/h4.png
|
113
155
|
- app/assets/stylesheets/markitup/sets/markdown/images/list-bullet.png
|
114
156
|
- app/assets/stylesheets/markitup/sets/markdown/images/quotes.png
|
@@ -155,6 +197,7 @@ files:
|
|
155
197
|
- app/assets/javascripts/formol/topics.js.coffee
|
156
198
|
- app/assets/javascripts/formol/preferences.js
|
157
199
|
- app/assets/javascripts/markitup/jquery.markitup.js
|
200
|
+
- app/assets/javascripts/markitup/sets/bbcode/set.js
|
158
201
|
- app/assets/javascripts/markitup/sets/markdown/set.js
|
159
202
|
- app/assets/javascripts/lib/jquery.prevent_double_submit.js.coffee
|
160
203
|
- app/mailers/formol/subscription_mailer.rb
|
@@ -232,6 +275,8 @@ files:
|
|
232
275
|
- config/locales/formol/views/topics/fr.yml
|
233
276
|
- config/locales/formol/views/posts/en.yml
|
234
277
|
- config/locales/formol/views/posts/fr.yml
|
278
|
+
- config/locales/formol/views/admin/forums/en.yml
|
279
|
+
- config/locales/formol/views/admin/categories/en.yml
|
235
280
|
- config/locales/formol/views/polls/en.yml.yml
|
236
281
|
- config/locales/formol/views/poll_votes/en.yml
|
237
282
|
- config/locales/en.yml
|