Commit 49e7109df55b26dae99c31b796296b4c533750d7
1 parent
79818886
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
#community dashboard - add infra
Showing
14 changed files
with
376 additions
and
0 deletions
Show diff stats
app/controllers/public/content_viewer_controller.rb
... | ... | @@ -115,6 +115,8 @@ class ContentViewerController < ApplicationController |
115 | 115 | if params[:slideshow] |
116 | 116 | render :action => 'slideshow', :layout => 'slideshow' |
117 | 117 | end |
118 | + | |
119 | + render :file => @page.view_page, :layout => true | |
118 | 120 | end |
119 | 121 | |
120 | 122 | def article_versions | ... | ... |
app/models/article.rb
plugins/community_hub/controllers/myprofile/community_dashboard_plugin_myprofile_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,18 @@ |
1 | +class CommunityDashboardPluginMyprofileController < MyProfileController | |
2 | + | |
3 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
4 | + | |
5 | + before_filter :allow_edit_dashboard, :only => :save_order | |
6 | + | |
7 | + def save_order | |
8 | + dashboard = profile.articles.find(params[:dashboard]) | |
9 | + redirect_to dashboard.url | |
10 | + end | |
11 | + | |
12 | + protected | |
13 | + | |
14 | + def allow_edit_dashboard | |
15 | + render_access_denied unless profile.articles.find(params[:dashboard]).allow_edit?(user) | |
16 | + end | |
17 | + | |
18 | +end | ... | ... |
plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,38 @@ |
1 | +class CommunityHubPlugin < Noosfero::Plugin | |
2 | + | |
3 | + def self.plugin_name | |
4 | + 'Community Hub' | |
5 | + end | |
6 | + | |
7 | + def self.plugin_description | |
8 | + _("New kind of content for communities.") | |
9 | + end | |
10 | + | |
11 | + def stylesheet? | |
12 | + true | |
13 | + end | |
14 | + | |
15 | + def js_files | |
16 | + 'javascripts/stream_post_form.js' | |
17 | + end | |
18 | + | |
19 | + def content_types | |
20 | + if context.respond_to?(:params) && context.params | |
21 | + types = [] | |
22 | + parent_id = context.params[:parent_id] | |
23 | + types << CommunityHubPlugin::Hub if context.profile.community? && !parent_id | |
24 | + types | |
25 | + else | |
26 | + [CommunityHubPlugin::Hub] | |
27 | + end | |
28 | + end | |
29 | + | |
30 | + #def self.extra_blocks | |
31 | + # { CommunityHubPlugin::HubBlock => {:position => 1} } | |
32 | + #end | |
33 | + | |
34 | + def content_remove_new(page) | |
35 | + page.kind_of?(CommunityHubPlugin::Hub) | |
36 | + end | |
37 | + | |
38 | +end | ... | ... |
... | ... | @@ -0,0 +1,27 @@ |
1 | +class CommunityHubPlugin::Hub < Folder | |
2 | + | |
3 | + def self.icon_name(article = nil) | |
4 | + 'community-hub' | |
5 | + end | |
6 | + | |
7 | + def self.short_description | |
8 | + _("Hub") | |
9 | + end | |
10 | + | |
11 | + def self.description | |
12 | + _('Defines a hub.') | |
13 | + end | |
14 | + | |
15 | + def view_page | |
16 | + "content_viewer/hub.rhtml" | |
17 | + end | |
18 | + | |
19 | + def bli | |
20 | + "bli" | |
21 | + end | |
22 | + | |
23 | + def accept_comments? | |
24 | + true | |
25 | + end | |
26 | + | |
27 | +end | |
0 | 28 | \ No newline at end of file | ... | ... |
plugins/community_hub/lib/community_hub_plugin/hub_stream_post.rb
0 → 100644
442 Bytes
plugins/community_hub/public/javascripts/stream_post_form.js
0 → 100644
... | ... | @@ -0,0 +1,62 @@ |
1 | +function send_message_for_stream(button) { | |
2 | + var $ = jQuery; | |
3 | + open_loading(DEFAULT_LOADING_MESSAGE); | |
4 | + var $button = $(button); | |
5 | + var form = $button.parents("form"); | |
6 | + $button.addClass('stream-post-button-loading'); | |
7 | + $.post(form.attr("action"), form.serialize(), function(data) { | |
8 | + if(data.render_target == null) { | |
9 | + } | |
10 | + else if(data.render_target == 'form') { | |
11 | + } | |
12 | + else if($('#' + data.render_target).size() > 0) { | |
13 | + } | |
14 | + else { | |
15 | + form.find("input[type='text']").add('textarea').each(function() { | |
16 | + this.value = ''; | |
17 | + }); | |
18 | + } | |
19 | + | |
20 | + close_loading(); | |
21 | + $button.removeClass('stream-post-button-loading'); | |
22 | + $button.enable(); | |
23 | + }, 'json'); | |
24 | +} | |
25 | + | |
26 | +function teste() { | |
27 | + alert('teste'); | |
28 | +} | |
29 | + | |
30 | +function send_post_for_mediation(button) { | |
31 | + var $ = jQuery; | |
32 | + open_loading(DEFAULT_LOADING_MESSAGE); | |
33 | + var $button = $(button); | |
34 | + var form = $button.parents("form"); | |
35 | + $button.addClass('stream-post-button-loading'); | |
36 | + $.post(form.attr("action"), form.serialize(), function(data) { | |
37 | + if(data.render_target == null) { | |
38 | + } | |
39 | + else if(data.render_target == 'form') { | |
40 | + } | |
41 | + else if($('#' + data.render_target).size() > 0) { | |
42 | + } | |
43 | + else { | |
44 | + form.find("input[type='text']").add('textarea').each(function() { | |
45 | + this.value = ''; | |
46 | + }); | |
47 | + } | |
48 | + | |
49 | + close_loading(); | |
50 | + $button.removeClass('stream-post-button-loading'); | |
51 | + $button.enable(); | |
52 | + }); | |
53 | +} | |
54 | + | |
55 | +function clearMediationForm(element) { | |
56 | + alert(element); | |
57 | + //var $field = $(field); | |
58 | + //$field.value = ''; | |
59 | +} | |
60 | + | |
61 | + | |
62 | +//setInterval(teste, 2000); | ... | ... |
... | ... | @@ -0,0 +1,27 @@ |
1 | +.icon-newcommunity-hub, | |
2 | +.icon-community-hub { | |
3 | + background-image: url(/plugins/community_hub/icons/community-hub.png) | |
4 | +} | |
5 | + | |
6 | +#hub{ | |
7 | + border:1px solid red; | |
8 | +} | |
9 | + | |
10 | +#hub .body{ | |
11 | + border:1px solid green; | |
12 | +} | |
13 | + | |
14 | +#hub .live{ | |
15 | + border:1px solid yellow; | |
16 | + float: left; | |
17 | + width: 50%; | |
18 | +} | |
19 | + | |
20 | +#hub .mediation{ | |
21 | + border:1px solid black; | |
22 | + width: 50%; | |
23 | +} | |
24 | + | |
25 | +#hub-posting-area td { | |
26 | + padding: 0px; | |
27 | +} | |
0 | 28 | \ No newline at end of file | ... | ... |
plugins/community_hub/views/content_viewer/_comment.rhtml
0 → 100644
... | ... | @@ -0,0 +1,37 @@ |
1 | +<li id="<%= comment.anchor %>" class="article-comment" style="border:1px solid black;"> | |
2 | + | |
3 | + <ul style="border:1px solid red;"> | |
4 | + <li style="border:1px solid red;"> | |
5 | + | |
6 | + <% if comment.author %> | |
7 | + <%= image_tag(profile_icon(comment.author, :minor)) %> | |
8 | + <% end %> | |
9 | + | |
10 | + </li> | |
11 | + <li style="border:1px solid red;"> | |
12 | + <%= show_time(comment.created_at) %> | |
13 | + </li> | |
14 | + <li style="border:1px solid red;"> | |
15 | + <%= txt2html comment.body %> | |
16 | + </li> | |
17 | + <li style="border:1px solid red;"> | |
18 | + | |
19 | + <ul style="border:1px solid red;"> | |
20 | + <li> | |
21 | + <a href="<%= url_for({:controller => 'comment', :action => 'destroy', :id => comment.id}) %>">remover postagem</a> | |
22 | + </li> | |
23 | + <li> | |
24 | + <a href="<%= url_for({:controller => 'comment', :action => 'destroy', :id => comment.id}) %>">promover usuário</a> | |
25 | + </li> | |
26 | + <li> | |
27 | + <a href="<%= url_for({:controller => 'comment', :action => 'destroy', :id => comment.id}) %>">curtir postagem</a> | |
28 | + </li> | |
29 | + <li> | |
30 | + <a href="<%= url_for({:controller => 'comment', :action => 'destroy', :id => comment.id}) %>">não curtir postagem</a> | |
31 | + </li> | |
32 | + </ul> | |
33 | + | |
34 | + </li> | |
35 | + </ul> | |
36 | + | |
37 | +</li> | ... | ... |
plugins/community_hub/views/content_viewer/_hub_mediation_item.rhtml
0 → 100644
... | ... | @@ -0,0 +1,134 @@ |
1 | +<!-- HUB --> | |
2 | +<div class="hub" style="border: 1px solid orange;"> | |
3 | + | |
4 | + <!-- HUB title --> | |
5 | + <div>jdhfjdhf</div> | |
6 | + | |
7 | + <!-- HUB description --> | |
8 | + <div>djfhkdhfkdjhfdkhffkdjfhkdjfh</div> | |
9 | + | |
10 | + <br /> | |
11 | + | |
12 | + <!-- HUB live section --> | |
13 | + <div style="border:1px solid red;"> | |
14 | + <div style="border:1px solid blue;"> | |
15 | + Nome do Título - AO VIVO | |
16 | + </div> | |
17 | + <div style="border:1px solid yellow;"> | |
18 | + <ul style="border:1px solid purple; margin: 0px;"> | |
19 | + <%= render :partial => 'content_viewer/comment', :collection => @comments %> | |
20 | + <%= pagination_links @comments, :param_name => 'comment_page' %> | |
21 | + </ul> | |
22 | + </div> | |
23 | + </div> | |
24 | + | |
25 | + <br /> | |
26 | + | |
27 | + <!-- HUB post form (guest user) --> | |
28 | + <div style="border:1px solid green;"> | |
29 | + | |
30 | + <% remote_form_for( :comment, | |
31 | + CommunityHubPlugin::HubStreamPost.new, | |
32 | + :url => { | |
33 | + :profile => profile.identifier, | |
34 | + :controller => 'comment', | |
35 | + :action => 'create', | |
36 | + :id => @page.id | |
37 | + }, | |
38 | + :html => { :class => 'comment_form' } ) do |f| %> | |
39 | + | |
40 | + <div> | |
41 | + <span><%= _("Streaming") %></span> | |
42 | + </div> | |
43 | + <div> | |
44 | + <%= f.text_area(:body, | |
45 | + :style => 'width: 99%;', | |
46 | + :placeholder => _('Type your message here')) %> | |
47 | + </div> | |
48 | + <div style="text-align: right;"> | |
49 | + <%= submit_button('add', _('Post message'), :onclick => "send_message_for_stream(this); return false;") %> | |
50 | + </div> | |
51 | + | |
52 | + <% end %> | |
53 | + | |
54 | + </div> | |
55 | + | |
56 | + <br /> | |
57 | + | |
58 | + <!-- HUB mediation section --> | |
59 | + <div style="border:1px solid green"> | |
60 | + <div style="border:1px solid blue;"> | |
61 | + Mediação | |
62 | + </div> | |
63 | + <div style="border:1px solid yellow;"> | |
64 | + <%= render :partial => 'hub_mediation_item' %> | |
65 | + </div> | |
66 | + </div> | |
67 | + | |
68 | + <br /> | |
69 | + | |
70 | + <div> | |
71 | + | |
72 | + <% | |
73 | + def mediation_timestamp | |
74 | + | |
75 | + end | |
76 | + %> | |
77 | + | |
78 | + <%= render :file => 'shared/tiny_mce' %> | |
79 | + | |
80 | + <% category_ids = [] %> | |
81 | + | |
82 | + <% remote_form_for( :article, | |
83 | + TinyMceArticle.new, | |
84 | + :url => { | |
85 | + :profile => profile.identifier, | |
86 | + :controller => 'cms', | |
87 | + :action => 'new', | |
88 | + :type => 'TinyMceArticle', | |
89 | + :success_back_to => "", | |
90 | + :q => "", | |
91 | + :parent_id => @page.id, | |
92 | + :back_to => "" | |
93 | + }, | |
94 | + :before => "tinymce.triggerSave()", | |
95 | + :loading => "alert('loading...')", | |
96 | + :complete => "tinymce.get('article_body').setContent('')", | |
97 | + :html => { :class => 'comment_form' } ) do |f| %> | |
98 | + | |
99 | + <%= f.hidden_field :moderate_comments, :value => 0 %> | |
100 | + <%= f.hidden_field :translation_of_id, :value => "" %> | |
101 | + <%= f.hidden_field :notify_comments, :value => 0 %> | |
102 | + <%= f.hidden_field :accept_comments, :value => 1 %> | |
103 | + <%= f.hidden_field :tag_list, :value => "" %> | |
104 | + <%= f.hidden_field :display_versions, :value => 0 %> | |
105 | + <%= f.hidden_field :allow_members_to_edit, :value => 0 %> | |
106 | + <%= f.hidden_field :abstract, :value => "" %> | |
107 | + <%= f.hidden_field :display_hits, :value => 0 %> | |
108 | + <%= f.hidden_field :parent_id, :value => 419 %> | |
109 | + <%= f.hidden_field :name, :value => "hub-mediation-" %> | |
110 | + <%= f.hidden_field :published, :value => true %> | |
111 | + <%= f.hidden_field :license_id, :value => "" %> | |
112 | + <%= hidden_field_tag "article[category_ids][]", "" %> | |
113 | + <%= f.hidden_field :language, :value => "en" %> | |
114 | + | |
115 | + <div style="border:1px solid green;"> | |
116 | + <div> | |
117 | + <span><%= _("Posting for mediation") %></span> | |
118 | + </div> | |
119 | + <div> | |
120 | + <%= f.text_area(:body, | |
121 | + :style => 'width: 99%;', | |
122 | + :class => 'mceEditor', | |
123 | + :placeholder => _('Type your message for mediation here')) %> | |
124 | + </div> | |
125 | + <div style="text-align: right;"> | |
126 | + <%= submit_button('add', _('Save'))%> | |
127 | + </div> | |
128 | + </div> | |
129 | + | |
130 | + <% end %> | |
131 | + | |
132 | + </div> | |
133 | + | |
134 | +</div> | ... | ... |