social_stream 0.15.8 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/README.rdoc +1 -1
  2. data/base/app/models/user.rb +1 -1
  3. data/base/app/views/devise/registrations/_edit_user.html.erb +26 -0
  4. data/base/app/views/devise/registrations/edit.html.erb +2 -1
  5. data/base/app/views/posts/_post_focus_search.html.erb +2 -2
  6. data/base/app/views/posts/_post_global_search.html.erb +2 -2
  7. data/base/config/locales/en.yml +4 -0
  8. data/base/db/migrate/20111221103509_add_language_field.rb +13 -0
  9. data/base/lib/social_stream/base/version.rb +1 -1
  10. data/documents/lib/social_stream/documents/version.rb +1 -1
  11. data/documents/social_stream-documents.gemspec +2 -2
  12. data/events/app/assets/javascripts/0_init.js +4 -0
  13. data/events/app/assets/javascripts/events.js.coffee +66 -0
  14. data/events/app/assets/stylesheets/events.css.scss +37 -0
  15. data/events/app/controllers/events_controller.rb +40 -0
  16. data/events/app/controllers/rooms_controller.rb +7 -0
  17. data/events/app/models/event.rb +53 -0
  18. data/events/app/models/room.rb +8 -0
  19. data/events/app/views/events/_event.html.erb +1 -0
  20. data/events/app/views/events/_new.html.erb +40 -0
  21. data/events/app/views/events/_sidebar_calendar.html.erb +26 -0
  22. data/events/app/views/events/create.js.erb +21 -0
  23. data/events/app/views/events/destroy.js.erb +1 -0
  24. data/events/app/views/events/index.html.erb +96 -0
  25. data/events/app/views/rooms/_form.html.erb +31 -0
  26. data/events/app/views/rooms/_index.html.erb +10 -0
  27. data/events/app/views/rooms/_settings.html.erb +23 -0
  28. data/events/app/views/rooms/create.js.erb +7 -0
  29. data/events/app/views/rooms/destroy.js.erb +1 -0
  30. data/events/config/locales/en.yml +34 -4
  31. data/events/config/locales/es.yml +34 -4
  32. data/events/config/routes.rb +1 -0
  33. data/events/db/migrate/20111101193523_create_events.rb +13 -0
  34. data/events/db/migrate/20111120104349_create_rooms.rb +26 -0
  35. data/events/db/migrate/20111204155637_add_scheduler.rb +33 -0
  36. data/events/db/migrate/20111218203314_change_scheduler.rb +11 -0
  37. data/events/lib/social_stream/events/ability.rb +13 -0
  38. data/events/lib/social_stream/events/engine.rb +17 -0
  39. data/events/lib/social_stream/events/models/actor.rb +13 -0
  40. data/events/lib/social_stream/events/version.rb +1 -1
  41. data/events/lib/social_stream/views/settings/events.rb +18 -0
  42. data/events/lib/social_stream-events.rb +15 -0
  43. data/events/social_stream-events.gemspec +6 -10
  44. data/events/vendor/assets/images/boxy-ne.png +0 -0
  45. data/events/vendor/assets/images/boxy-nw.png +0 -0
  46. data/events/vendor/assets/images/boxy-se.png +0 -0
  47. data/events/vendor/assets/images/boxy-sw.png +0 -0
  48. data/events/vendor/assets/javascripts/fullcalendar.js +12 -10
  49. data/events/vendor/assets/javascripts/gcal.js +2 -2
  50. data/events/vendor/assets/javascripts/jquery.boxy.js +570 -0
  51. data/events/vendor/assets/javascripts/sprintf.js +183 -0
  52. data/events/vendor/assets/stylesheets/boxy.css +49 -0
  53. data/events/vendor/assets/stylesheets/fullcalendar.css +7 -10
  54. data/events/vendor/assets/stylesheets/fullcalendar.print.css +4 -4
  55. data/lib/social_stream/version.rb +1 -1
  56. data/linkser/app/assets/javascripts/linkser.js.erb +7 -3
  57. data/linkser/app/models/link.rb +2 -0
  58. data/linkser/app/views/links/_link.html.erb +1 -1
  59. data/linkser/app/views/links/_link_preview.html.erb +6 -0
  60. data/linkser/db/migrate/20111219122952_add_width_height_to_link.rb +15 -0
  61. data/linkser/lib/social_stream/linkser/version.rb +1 -1
  62. data/linkser/social_stream-linkser.gemspec +1 -1
  63. data/social_stream.gemspec +4 -4
  64. metadata +61 -42
  65. data/events/db/migrate/20110910161707_create_social_stream_events.rb +0 -54
  66. data/events/db/migrate/20111102145626_add_more_fields_to_events.rb +0 -20
  67. data/events/db/migrate/20111104165944_add_more_fields_to_sessions.rb +0 -13
  68. data/events/db/migrate/20111104182420_add_details_to_events.rb +0 -18
  69. data/events/db/migrate/20111209120019_reset_events.rb +0 -18
  70. data/events/vendor/assets/javascripts/jquery.ad-gallery.js +0 -850
  71. data/events/vendor/assets/javascripts/jquery.ad-gallery.pack.js +0 -10
  72. data/events/vendor/assets/stylesheets/ad_next.png +0 -0
  73. data/events/vendor/assets/stylesheets/ad_prev.png +0 -0
  74. data/events/vendor/assets/stylesheets/ad_scroll_back.png +0 -0
  75. data/events/vendor/assets/stylesheets/ad_scroll_forward.png +0 -0
  76. data/events/vendor/assets/stylesheets/jquery.ad-gallery.css +0 -171
  77. data/events/vendor/assets/stylesheets/loader.gif +0 -0
  78. data/events/vendor/assets/stylesheets/social_stream-events.css +0 -273
data/README.rdoc CHANGED
@@ -54,7 +54,7 @@ Current Social Stream distribution includes:
54
54
  along with users, group, post and comments
55
55
  * {Social Stream Documents}[https://github.com/ging/social_stream/tree/master/documents], support for
56
56
  activities on files
57
- * {Social Stream Events}[https://github.com/ging/social_stream/tree/master/events], videoconference events with an agenda and several sessions
57
+ * {Social Stream Events}[https://github.com/ging/social_stream/tree/master/events], sheduled events with calendar
58
58
  * {Social Stream Linkser}[https://github.com/ging/social_stream/tree/master/linkser], advanced management of links to other webpages
59
59
 
60
60
  = Documentation
@@ -12,7 +12,7 @@ class User < ActiveRecord::Base
12
12
  :foreign_key => :user_author_id
13
13
 
14
14
  # Setup accessible (or protected) attributes for your model
15
- attr_accessible :name, :email, :password, :password_confirmation, :remember_me, :profile_attributes
15
+ attr_accessible :name, :email, :password, :password_confirmation, :language, :remember_me, :profile_attributes
16
16
 
17
17
  validates_presence_of :email
18
18
 
@@ -85,3 +85,29 @@ $(".user_edit").validate({errorClass: "validation_error"});
85
85
  <% end%>
86
86
  </div>
87
87
  </div>
88
+ <div class="block" id="lang_form">
89
+ <div class="header">
90
+ <div class="header_text">
91
+ <%= t("account.lang.change")%>
92
+ </div>
93
+ <div class="header_icon_right">
94
+ <%= link_to (image_tag('btn/edit.png')), "javascript:showSettings(\"lang_form\");" %>
95
+ </div>
96
+ </div>
97
+ <div id="lang_form_briefing" class="settings_briefing content">
98
+ <div class="form_row">
99
+ <%= t('settings.lang_change.briefing')%>
100
+ </div>
101
+ </div>
102
+ <div class="content settings_content" id="lang_form_content" style="display:none;">
103
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :id => 'form_lang' }) do |f| %>
104
+ <div class="form_row">
105
+ <div class="form_label"><%= f.label :language %></div>
106
+ <div class="form_field">
107
+ <%= f.select :language, I18n.available_locales.map{|l| [ l.to_s, l.to_s ] }, { }, { :class => 'form_lang', :onchange => "$(\'#form_lang\').submit();" } %>
108
+ </div>
109
+ </div>
110
+ <% end%>
111
+ </div>
112
+ </div>
113
+
@@ -18,4 +18,5 @@
18
18
  <%= render :partial => "settings/api_key" %>
19
19
  <% end %>
20
20
  <%= render :partial => "settings/contacts" %>
21
- <%= render :partial => "delete_account"%>
21
+ <%= render :partial => "delete_account"%>
22
+
@@ -11,9 +11,9 @@
11
11
  </div>
12
12
  <div class="activity_objects">
13
13
  <%= link_to post do%>
14
- <% text = excerpt(strip_tags(post.text),get_search_query_words.first,:radius => 180) %>
14
+ <% text = excerpt(strip_tags(post.text),get_search_query_words.first,:radius => 180) || "" %>
15
15
  <% if text.length < 400 %>
16
- <% text = excerpt(strip_tags(post.text),get_search_query_words.first,:radius => 540 - text.length) %>
16
+ <% text = excerpt(strip_tags(post.text),get_search_query_words.first,:radius => 540 - text.length) || "" %>
17
17
  <% end %>
18
18
  <%= highlight(text,get_search_query_words) %>
19
19
  <% end %>
@@ -6,9 +6,9 @@
6
6
  <div class="sub-block">
7
7
  <div class="brief">
8
8
  <%= link_to post do%>
9
- <% text = excerpt(strip_tags(post.text),get_search_query_words.first,:radius => 25) %>
9
+ <% text = excerpt(strip_tags(post.text),get_search_query_words.first,:radius => 25) || "" %>
10
10
  <% if text.length < 60 %>
11
- <% text = excerpt(strip_tags(post.text),get_search_query_words.first,:radius => 30 + (60 - text.length)) %>
11
+ <% text = excerpt(strip_tags(post.text),get_search_query_words.first,:radius => 30 + (60 - text.length)) || "" %>
12
12
  <% end %>
13
13
  <%= highlight(text,get_search_query_words) %>
14
14
  <% end %>
@@ -9,6 +9,8 @@ en:
9
9
  edit: "Edit account"
10
10
  email:
11
11
  change: "Change email address"
12
+ lang:
13
+ change: "Change language"
12
14
  one: "Account"
13
15
  password:
14
16
  change: "Change password"
@@ -429,6 +431,8 @@ en:
429
431
  briefing: "Lets you cancel your account"
430
432
  email_change:
431
433
  briefing: "Change your email"
434
+ lang_change:
435
+ briefing: "Change your language"
432
436
  error: "Some errors raised when saving your changes"
433
437
  for: "Settings for"
434
438
  main: "Settings"
@@ -0,0 +1,13 @@
1
+ class AddLanguageField < ActiveRecord::Migration
2
+ def self.up
3
+ change_table "users" do |t|
4
+ t.string "language", :default => "en"
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ change_table :users do |t|
10
+ t.remove "language"
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.10.11".freeze
3
+ VERSION = "0.11.0".freeze
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Documents
3
- VERSION = "0.5.2".freeze
3
+ VERSION = "0.6.0".freeze
4
4
  end
5
5
  end
@@ -7,12 +7,12 @@ Gem::Specification.new do |s|
7
7
  s.authors = ["Víctor Sánchez Belmar", "GING - DIT - UPM"]
8
8
  s.summary = "File capabilities for Social Stream, the core for building social network websites"
9
9
  s.description = "Social Stream is a Ruby on Rails engine providing your application with social networking features and activity streams.\n\nThis gem allow you upload almost any kind of file as new social stream activity."
10
- s.email = "v.sanchezbelmar@gmail.com"
10
+ s.email = "social-stream@dit.upm.es"
11
11
  s.homepage = "http://github.com/ging/social_stream-documents"
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.10.6')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.11.0')
16
16
  s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
17
17
  # Waiting for version > 2.4.5, which fixes:
18
18
  # https://github.com/thoughtbot/paperclip/issues/293
@@ -0,0 +1,4 @@
1
+ var SocialStream = SocialStream || {};
2
+ SocialStream.Events = SocialStream.Events || {};
3
+ SocialStream.Events.current = SocialStream.Events.current || {};
4
+
@@ -0,0 +1,66 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
4
+ #
5
+ #= require fullcalendar
6
+ #= require jquery.boxy
7
+ #= require sprintf
8
+ #= require scheduler
9
+
10
+ SocialStream.Events.create = (start, end, allDay) ->
11
+ title = prompt('Event Title:');
12
+ if title
13
+ $.post(SocialStream.Events.current.eventsPath,
14
+ {
15
+ event: {
16
+ title: title,
17
+ start_at: start.toString(),
18
+ end_at: end.toString(),
19
+ all_day: allDay,
20
+ _contact_id: SocialStream.Events.current.contactId
21
+ }
22
+ },
23
+ undefined,
24
+ "script");
25
+
26
+ SocialStream.Events.tools = {}
27
+
28
+ SocialStream.Events.tools.currentRGB = () ->
29
+ [ parseInt(SocialStream.Events.current.eventColor[1..2], 16),
30
+ parseInt(SocialStream.Events.current.eventColor[3..4], 16),
31
+ parseInt(SocialStream.Events.current.eventColor[5..6], 16) ]
32
+
33
+ SocialStream.Events.tools.colorRange = () ->
34
+ min = 0
35
+
36
+ for color in SocialStream.Events.tools.currentRGB()
37
+ if color < min
38
+ min = color
39
+
40
+ parseInt 2 * (255 - min) / 3
41
+
42
+ SocialStream.Events.tools.increaseColor = (delta) ->
43
+ (if (color + delta) > 255 then 255 else (color + delta)) for color in SocialStream.Events.tools.currentRGB()
44
+
45
+
46
+ SocialStream.Events.tools.eventColorScale = (index) ->
47
+ range = SocialStream.Events.tools.colorRange()
48
+
49
+ delta = range * (index + 1) / (SocialStream.Events.current.roomIndex.length + 1)
50
+
51
+ delta = parseInt(delta)
52
+
53
+ newColor = SocialStream.Events.tools.increaseColor(delta)
54
+
55
+ sprintf "#%02x%02x%02x", newColor[0], newColor[1], newColor[2]
56
+
57
+
58
+ SocialStream.Events.tools.eventColor = (roomId) ->
59
+ currentColor = SocialStream.Events.current.eventColor
60
+
61
+ if not roomId? or not SocialStream.Events.current.roomIndex? or SocialStream.Events.current.roomIndex.length == 0
62
+ return currentColor
63
+
64
+ currentRoomIndex = SocialStream.Events.current.roomIndex.indexOf(roomId)
65
+
66
+ SocialStream.Events.tools.eventColorScale(currentRoomIndex)
@@ -0,0 +1,37 @@
1
+ // Place all the styles related to the events controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
4
+ //
5
+ //= require fullcalendar
6
+ //= require boxy
7
+
8
+ #calendar {
9
+ margin-top: 20px;
10
+ }
11
+
12
+ #sidebar_calendar_date {
13
+ margin-left: 5px;
14
+ }
15
+
16
+ #sidebar_calendar {
17
+ width: 100%;
18
+ text-align: center;
19
+ padding-top: 5px;
20
+ }
21
+
22
+ #sidebar_calendar a {
23
+ color: black;
24
+ }
25
+
26
+ #sidebar_calendar td {
27
+ height: 25px;
28
+ border: 1px solid #CCCCCC;
29
+ }
30
+
31
+ #new_event div.form_row {
32
+ padding: 3px 0;
33
+ }
34
+
35
+ #scheduler-options {
36
+ padding: 2px 10px;
37
+ }
@@ -0,0 +1,40 @@
1
+ class EventsController < ApplicationController
2
+ include SocialStream::Controllers::Objects
3
+
4
+ belongs_to_subjects :optional => true
5
+
6
+ before_filter :profile_subject!, :only => :index
7
+
8
+ def index
9
+ index! do |format|
10
+ format.json {
11
+ start_time = Time.at(params[:start].to_i)
12
+ end_time = Time.at(params[:end].to_i)
13
+ @activities =
14
+ collection.
15
+ joins(:activity_objects => :event).
16
+ merge(Event.between(start_time, end_time))
17
+
18
+ render :json =>
19
+ @activities.
20
+ map(&:direct_object).
21
+ map{ |e| e.to_json(:start => start_time, :end => end_time) }.flatten.to_json
22
+ }
23
+ end
24
+ end
25
+
26
+ def show
27
+ show! do |format|
28
+ format.html { redirect_to polymorphic_path([ @event.post_activity.receiver_subject, Event.new ], :at => @event.start_at.to_i) }
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def collection
35
+ @activities =
36
+ profile_subject.wall(:profile,
37
+ :for => current_subject,
38
+ :object_type => :Event)
39
+ end
40
+ end
@@ -0,0 +1,7 @@
1
+ class RoomsController < InheritedResources::Base
2
+ actions :create, :destroy
3
+
4
+ respond_to :js
5
+
6
+ load_and_authorize_resource
7
+ end
@@ -0,0 +1,53 @@
1
+ class Event < ActiveRecord::Base
2
+ include SocialStream::Models::Object
3
+
4
+ scheduler
5
+
6
+ belongs_to :room
7
+
8
+ validates_presence_of :title
9
+
10
+ validate :room_belongs_to_receiver
11
+
12
+ def to_json(options = {})
13
+ if recurrence
14
+ st = options[:start].try(:to_date)
15
+ en = (options[:end] || end_at.end_of_month + 7.days).to_date
16
+
17
+ recurrence.events(:starts => st, :until => en).map do |d|
18
+
19
+ start_diff = d - start_at.to_date
20
+ end_diff = d - end_at.to_date
21
+
22
+ build_json start_at.advance(:days => start_diff),
23
+ end_at.advance(:days => end_diff)
24
+ end
25
+ else
26
+ build_json
27
+ end
28
+ end
29
+
30
+ protected
31
+
32
+ def build_json(start_time = start_at, end_time = end_at)
33
+ {
34
+ :id => id,
35
+ :title => title,
36
+ :start => start_time,
37
+ :end => end_time,
38
+ :allDay => all_day?,
39
+ :roomId => room_id
40
+ }
41
+
42
+ end
43
+
44
+ private
45
+
46
+ def room_belongs_to_receiver
47
+ return if room_id.blank?
48
+
49
+ unless _contact.receiver.room_ids.include?(room_id)
50
+ errors.add(:room_id, :invalid)
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,8 @@
1
+ class Room < ActiveRecord::Base
2
+ belongs_to :actor
3
+
4
+ has_many :events
5
+
6
+ validates_presence_of :actor_id, :name
7
+ validates_uniqueness_of :name, :scope => :actor_id
8
+ end
@@ -0,0 +1 @@
1
+ <%= raw t('event.wall_post', :title => link_to(h(event.title), event)) %>
@@ -0,0 +1,40 @@
1
+ <%= form_for @event || Event.new(:owner_id => profile_subject.actor_id, :interval => 1), :remote => true do |f| %>
2
+ <%= f.hidden_field :owner_id %>
3
+ <%= f.hidden_field :start_at %>
4
+ <%= f.hidden_field :end_at %>
5
+ <%= f.hidden_field :all_day %>
6
+
7
+ <% if f.object.errors.any? %>
8
+ <div id="error_explanation">
9
+ <h2><%= pluralize(f.object.errors.count, "error") %> evitaron que se guardara esta actividad:</h2>
10
+
11
+ <ul>
12
+ <% f.object.errors.full_messages.each do |msg| %>
13
+ <li><%= msg %></li>
14
+ <% end %>
15
+ </ul>
16
+ </div>
17
+ <% end %>
18
+
19
+ <div class="form_row">
20
+ <%= f.label :title %>
21
+ <%= f.text_field :title %>
22
+ </div>
23
+
24
+ <% if profile_subject.rooms.any? %>
25
+ <div class="form_row">
26
+ <%= f.label :room %>
27
+ <%= f.select :room_id, profile_subject.rooms.map{ |r| [r.name, r.id] }, { :include_blank => true } %>
28
+ </div>
29
+ <% end %>
30
+
31
+ <div class="form_row">
32
+ <%= render :partial => 'scheduler/form',
33
+ :locals => { :f => f }
34
+ %>
35
+ </div>
36
+
37
+ <div class="form_row space_center">
38
+ <%= f.submit %>
39
+ </div>
40
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <div class="space_center"></div>
2
+
3
+ <div class="block">
4
+ <div class="header">
5
+ <div class="header_text"><%= t 'event.title' %></div>
6
+ </div>
7
+
8
+ <div class="content">
9
+ <span id="sidebar_calendar_date"><%= l Date.today, :format => :long %></span>
10
+
11
+ <table id="sidebar_calendar">
12
+ <% bow = Time.now.beginning_of_week %>
13
+
14
+ <% 28.times do |i| %>
15
+ <% day = bow + i.days %>
16
+
17
+ <%= raw cycle("<tr>", *6.times.map{""}, :name => "tr_start") %>
18
+ <td<%= " class=\"fc-state-highlight\"".html_safe if day.today? %>>
19
+ <%= link_to day.day, polymorphic_path([subject, Event.new], :at => day.to_i) %>
20
+ </td>
21
+
22
+ <%= raw cycle(*6.times.map{""}, '</tr>', :name => "tr_end") %>
23
+ <% end %>
24
+ </table>
25
+ </div>
26
+ </div>
@@ -0,0 +1,21 @@
1
+ <% if @event.valid? %>
2
+ SocialStream.Events.current.newForm.unload();
3
+
4
+ var cal = SocialStream.Events.current.calendar;
5
+
6
+ jQuery.each(<%= raw Array.wrap(@event.to_json).to_json %>,
7
+ function(index, ev) {
8
+ ev.color = SocialStream.Events.tools.eventColor(<%= @event.room_id %>);
9
+
10
+ cal.fullCalendar('renderEvent', ev,
11
+ true // make the event "stick"
12
+ );
13
+ });
14
+
15
+ cal.fullCalendar('unselect');
16
+
17
+ <% else %>
18
+ SocialStream.Events.current.newForm.setContent("<%= escape_javascript render(:partial => 'new') %>");
19
+
20
+ Scheduler.form.init(SocialStream.Events.current.newForm.getContent().find('.scheduler_form'));
21
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render(:partial => 'objects/destroy') %>
@@ -0,0 +1,96 @@
1
+ <% content_for :headers do %>
2
+ <style type="text/css">
3
+ #sidebar {width: 0px;}
4
+ #center_body {width: 780px; max-width: 780px;}
5
+ </style>
6
+ <% end %>
7
+
8
+ <% content_for :title do %>
9
+ <%= profile_subject.name + ": " + t('event.title') %>
10
+ <% end %>
11
+
12
+ <%= location(
13
+ link_to(profile_subject.name, polymorphic_path(profile_subject)),
14
+ link_to(t('event.title'), polymorphic_path([profile_subject, Event.new]))
15
+ ) %>
16
+
17
+ <% toolbar :profile => profile_subject %>
18
+
19
+ <div id="calendar"></div>
20
+
21
+ <%= javascript_tag do %>
22
+ $(function(){
23
+
24
+ <% if profile_subject.respond_to? :rooms %>
25
+ SocialStream.Events.current.roomIndex = <%= raw profile_subject.rooms.map(&:id) %>;
26
+ <% end %>
27
+
28
+ SocialStream.Events.current.eventColor = '#58310E';
29
+
30
+ SocialStream.Events.current.calendar = $('#calendar').fullCalendar({
31
+ header: {
32
+ left: 'prev,next today',
33
+ center: 'title',
34
+ right: 'month,agendaWeek,agendaDay'
35
+ },
36
+ firstDay: 1,
37
+ eventColor: SocialStream.Events.current.eventColor,
38
+ <% if can? :create, new_post(profile_subject) %>
39
+ selectable: true,
40
+ selectHelper: true,
41
+ select: function(startDate, endDate, allDay, jsEvent){
42
+
43
+ SocialStream.Events.current.newForm = new Boxy(
44
+ "<%= escape_javascript render(:partial => 'events/new') %>",
45
+ {
46
+ title: "<%= t('event.new.title') %>",
47
+ closeable: true,
48
+ closeText: "<%= t('boxy.close_text') %>",
49
+ draggable: true
50
+ }
51
+ );
52
+
53
+
54
+ SocialStream.Events.current.newForm.moveTo(jsEvent.clientX, jsEvent.clientY);
55
+
56
+ var c = SocialStream.Events.current.newForm.getContent();
57
+
58
+ c.children('#event_start_at').val(startDate.toJSON());
59
+ c.children('#event_end_at').val(endDate.toJSON());
60
+ c.children('#event_all_day').val(allDay.toString());
61
+
62
+ // From rails-scheduler gem
63
+ Scheduler.form.init(c.find('.scheduler_form'), startDate);
64
+ },
65
+ <% end %>
66
+ // Implement event edition
67
+ // editable: true,
68
+ events: function(start, end, callback) {
69
+ $.ajax({
70
+ url: "<%= escape_javascript polymorphic_path([profile_subject, Event.new]) %>",
71
+ dataType: 'json',
72
+ data: {
73
+ // our hypothetical feed requires UNIX timestamps
74
+ start: Math.round(start.getTime() / 1000),
75
+ end: Math.round(end.getTime() / 1000)
76
+ },
77
+ success: function(events) {
78
+ callback(
79
+ $.map(events, function(event) {
80
+ event.color = SocialStream.Events.tools.eventColor(event.roomId);
81
+ return event;
82
+ }
83
+ )
84
+ );
85
+ }
86
+ });
87
+ }
88
+ });
89
+
90
+ <% if params[:at] %>
91
+ // TODO: optimize this to save one index call
92
+ SocialStream.Events.current.calendar.fullCalendar('changeView', "agendaDay");
93
+ SocialStream.Events.current.calendar.fullCalendar('gotoDate', new Date(<%= params[:at] %> * 1000));
94
+ <% end %>
95
+ });
96
+ <% end %>
@@ -0,0 +1,31 @@
1
+ <%= form_for @room || Room.new(:actor => current_subject.actor), :remote => true do |f| %>
2
+ <%= f.hidden_field :actor_id %>
3
+
4
+ <% if f.object.errors.any? %>
5
+ <div id="error_explanation">
6
+ <h2><%= pluralize(f.object.errors.count, "error") %> evitaron que se guardara este espacio:</h2>
7
+
8
+ <ul>
9
+ <% f.object.errors.full_messages.each do |msg| %>
10
+ <li><%= msg %></li>
11
+ <% end %>
12
+ </ul>
13
+ </div>
14
+ <% end %>
15
+
16
+ <div class="row">
17
+ <div class="label">
18
+ <%= f.text_field :name %>
19
+ </div>
20
+
21
+ <div class="field">
22
+ <%= f.submit %>
23
+ </div>
24
+ </div>
25
+ <% end %>
26
+
27
+ <%= javascript_tag do %>
28
+ $(function(){
29
+ $('#room_name').Watermark("<%= escape_javascript t('room.watermark.name') %>");
30
+ });
31
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <div id="rooms">
2
+ <% current_subject.rooms.each do |room| %>
3
+ <div class="row">
4
+ <div class="label"><%= room.name %></div>
5
+ <div class="field">
6
+ <%= link_to image_tag("btn/delete.png", :class => "menu_icon", :title => t('room.delete')), room, :class => "room_delete_link", :method => :delete, :confirm => t('room.confirm_delete'), :remote => true %>
7
+ </div>
8
+ </div>
9
+ <% end %>
10
+ </div>
@@ -0,0 +1,23 @@
1
+ <div class="block" id="room_settings">
2
+ <div class="header">
3
+ <div class="header_text">
4
+ <%= t 'room.settings.title' %>
5
+ </div>
6
+ <div class="header_icon_right">
7
+ <%= link_to image_tag('btn/edit.png'), "javascript:showSettings(\"room_settings\");" %>
8
+ </div>
9
+ </div>
10
+ <div id="room_settings_briefing" class="settings_briefing content">
11
+ <div class="form_row">
12
+ <%= t 'room.settings.description' %>
13
+ </div>
14
+ </div>
15
+ <div class="content settings_content" id="room_settings_content" style="display:none;">
16
+ <div class="sub-block">
17
+ <%= render :partial => 'rooms/index' %>
18
+ </div>
19
+ <div class="sub-block">
20
+ <%= render :partial => 'rooms/form' %>
21
+ </div>
22
+ </div>
23
+ </div>
@@ -0,0 +1,7 @@
1
+ <% if @room.valid? %>
2
+ $('#rooms').replaceWith("<%= escape_javascript render(:partial => 'index') %>");
3
+ $('#room_name').val("");
4
+ $('#room_name').Watermark("<%= escape_javascript t('room.watermark.name') %>");
5
+ <% else %>
6
+ $('#new_room').replaceWith("<%= escape_javascript render(:partial => 'form') %>");
7
+ <% end %>
@@ -0,0 +1 @@
1
+ $('#rooms').replaceWith("<%= escape_javascript render(:partial => 'index') %>");