my_timeline 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 180963925c947c23df9af5971da60bee552c0a8a
4
- data.tar.gz: 7c1c93ed23f8eb0042a49fc1980bf0983d8156aa
3
+ metadata.gz: 3b1e4e734b8ba08d97b8c8b37940ce764ddc25a7
4
+ data.tar.gz: ec08da26e73fbcecd5fc7ea2259b3428bf272b0f
5
5
  SHA512:
6
- metadata.gz: 7772eed0229ad702ca03290f9e86755eb0eee82df4a78463f119f55be92f654b4e7ee9fd9977d809aa627d19bc666714795eec9cdf91a0c0064edb58fb0d5c9e
7
- data.tar.gz: 3586a2d72d86d44d9dea55a77956db5a7f8d6ef288f5861031a3d9495bf308f3470b18f22a4a29d1debfa0ed2084e2272ff4ef413eadb35a06da48a157cc03ab
6
+ metadata.gz: 84358a06da83329cc1800936b42361c81093f4a616272616c9b74f5a90f131318ad45ce4517e2b018eb44702e61535ac83b0bb6043610fbed0d30dbf88ad92ab
7
+ data.tar.gz: 8a55367c195632241c959e9efc07ad11b327f5e895b36fc3c3362a71fca778a02843053fdafafffca6ef47f67498610a337e11cef6a7dafc62e066fa1e5eedb0
data/CHANGELOG.markdown CHANGED
@@ -1,9 +1,13 @@
1
+ # 0.0.5
2
+ * [FEATURE] Added a detail view that expands below the summary post, if that model supports an expandable view (defaults to not.)
3
+ * [BUGFIX] Dehardcode header text
4
+
1
5
  # 0.0.4
2
- * Added Rails 4 compatibility
3
- * Added more tests
6
+ * [FEATURE] Added Rails 4 compatibility
7
+ * [FEATURE] Added more tests
4
8
 
5
9
  # 0.0.3
6
- * Fixed external event link
10
+ * [BUGFIX] Fixed external event link
7
11
 
8
12
  # 0.0.2
9
13
  * Many, many bugfixes
@@ -0,0 +1,22 @@
1
+ $ ->
2
+ $("a.event_expand").click (event) ->
3
+ event.preventDefault()
4
+
5
+ event_id = $(this).attr("id").replace /[A-Z_a-z$-]/g, ""
6
+ div_id = "div#event_" + event_id
7
+ url = $("span#event_url_" + event_id).text()
8
+
9
+ if $(div_id).css('display') == 'none'
10
+ $.ajax url,
11
+ type: 'GET'
12
+ dataType: 'html'
13
+ error: (jqXHR, textStatus, errorThrown) ->
14
+ $(div_id).html errorThrown
15
+ $(div_id).toggle()
16
+
17
+ success: (data, textStatus, jqXHR) ->
18
+ $(div_id).html data
19
+ $(div_id).toggle()
20
+ else
21
+ $(div_id).toggle()
22
+
@@ -4,5 +4,24 @@ module MyTimeline
4
4
  def index
5
5
  @enabled_plugins = MyTimeline.enabled_plugins
6
6
  end
7
+
8
+ def timezone
9
+ if rails4?
10
+ @user.time_zone = user_params[:time_zone]
11
+ else
12
+ @user.time_zone = params[:user][:time_zone]
13
+ end
14
+
15
+ @user.save!
16
+ redirect_to :back, notice: "Time zone setting saved."
17
+ end
18
+
19
+ private
20
+
21
+ if rails4?
22
+ define_method :user_params do
23
+ params.required(:user).permit :time_zone
24
+ end
25
+ end
7
26
  end
8
27
  end
@@ -19,11 +19,11 @@ module MyTimeline
19
19
  end
20
20
 
21
21
  def edit
22
- @event = Event.find_by_id(params[:id])
22
+ @event = Event.find_by_id params[:id]
23
23
  end
24
24
 
25
25
  def update
26
- @event = Event.find_by_id(params[:id])
26
+ @event = Event.find_by_id params[:id]
27
27
  if @event.update_attributes(rails4? ? event_params : params[:event])
28
28
  redirect_to root_path, notice: "Edit successful."
29
29
  else
@@ -23,6 +23,11 @@ module MyTimeline
23
23
  end
24
24
  end
25
25
 
26
+ def show
27
+ @post = Post.find_by_id params[:id]
28
+ render text: @post.full_text
29
+ end
30
+
26
31
  private
27
32
 
28
33
  if rails4?
@@ -12,5 +12,9 @@ module MyTimeline
12
12
  validates :full_text, presence: true
13
13
 
14
14
  accepts_nested_attributes_for :event
15
+
16
+ def self.is_exandable?
17
+ true
18
+ end
15
19
  end
16
20
  end
@@ -0,0 +1,5 @@
1
+ <%= form_for @user, url: control_panel_timezone_path, method: :post do |f| %>
2
+ <%= f.time_zone_select :time_zone %>
3
+ <br>
4
+ <%= f.submit 'Save', class: "btn btn-primary" %>
5
+ <% end %>
@@ -2,8 +2,16 @@
2
2
  <h1><%= I18n.t("my_timeline.control_panel.header") %></h1>
3
3
  </div>
4
4
 
5
+ <div>
6
+ <h3>My Settings</h2>
7
+ <%= render partial: "my_timeline/control_panel/time_zone" %>
8
+ </div>
9
+
10
+ <hr>
11
+
5
12
  <% @enabled_plugins.each do |plug| %>
6
13
  <%= render partial: "my_timeline/#{plug}/control_panel" %>
14
+ <hr>
7
15
  <% end %>
8
16
 
9
17
  <h3> New Post </h3>
@@ -1,6 +1,10 @@
1
1
  <p>
2
- <%= link_to event.external_link do %>
3
- <%= glyph 'plus-sign' %>
2
+ <% if event.linkable.class.respond_to? :is_exandable? %>
3
+ <%= link_to "#", class: "event_expand", id: "event_#{event.id}" do %>
4
+ <%= glyph 'plus-sign' %>
5
+ <% end %>
6
+ <% end %>
7
+ <%= link_to event.external_link do %>
4
8
  <%= image_tag event.icon_path, size: "32x32" %>
5
9
  <% end %>
6
10
  <%= event.happened_on %> -
@@ -14,3 +18,10 @@
14
18
  <% end %>
15
19
  <% end %>
16
20
  </p>
21
+ <% if event.linkable.class.respond_to? :is_exandable? %>
22
+ <div class="event_details" id="event_<%= event.id %>" style="display:none;">
23
+ </div>
24
+ <span class="event_url" id="event_url_<%= event.id %>" style="display:none;">
25
+ <%= polymorphic_url [my_timeline, event.linkable] %>
26
+ </span>
27
+ <% end %>
@@ -1,6 +1,10 @@
1
- <div class="page-header">
2
- <small>A demonstration timeline</small>
3
- </div>
1
+ <%= javascript_include_tag "my_timeline/events" %>
2
+
3
+ <% if t "my_timeline.timeline_header", default: nil %>
4
+ <div class="page-header">
5
+ <small><%= t "my_timeline.timeline_header" %></small>
6
+ </div>
7
+ <% end %>
4
8
 
5
9
  <% @dates_with_events.each do |day| %>
6
10
  <h4><%= date_header_string day[:date] %></h4>
@@ -1,5 +1,5 @@
1
1
  en:
2
2
  my_timeline:
3
- timeline_header: Timeline
3
+ timeline_header: A demonstration timeline
4
4
  control_panel:
5
5
  header: Control Panel
data/config/routes.rb CHANGED
@@ -4,5 +4,6 @@ MyTimeline::Engine.routes.draw do
4
4
  resources :events
5
5
  resources :posts
6
6
 
7
- get "control_panel" => "control_panel#index", as: "control_panel"
7
+ get "control_panel" => "control_panel#index", as: "control_panel"
8
+ post "control_panel" => "control_panel#timezone", as: "control_panel_timezone"
8
9
  end
@@ -8,15 +8,28 @@ module MyTimeline
8
8
  self.table_name = "my_timeline_settings"
9
9
 
10
10
  MyTimeline.config_object = ::RailsSettings::Configuration.new(MyTimeline.user_class) do |s|
11
- s.key :empty_placeholder
11
+ s.key :core
12
12
  end
13
13
 
14
14
  MyTimeline.user_class.class_eval do
15
15
  self.send :include, ::RailsSettings::Base
16
16
  self.send :extend, ::RailsSettings::Scopes
17
17
 
18
- MyTimeline.config_object.key :twitter, defaults: {foo: "bar"}
19
- MyTimeline.config_object.key :github, defaults: {foo: "bar"}
18
+ def self.settings_attr_accessor(*args)
19
+ args.each do |method_name|
20
+ eval "
21
+ def #{method_name}
22
+ self.settings(:core).send(:#{method_name})
23
+ end
24
+ def #{method_name}=(value)
25
+ self.settings(:core).send(:#{method_name}=, value)
26
+ end
27
+ "
28
+ end
29
+ end
30
+
31
+ settings_attr_accessor :time_zone
32
+
20
33
  end unless MyTimeline.user_class == MyTimeline::UserStub
21
34
  end
22
35
  end
@@ -1,5 +1,6 @@
1
1
  module MyTimeline
2
2
  class UserStub
3
+
3
4
  def self.events
4
5
  Event
5
6
  end
@@ -23,5 +24,20 @@ module MyTimeline
23
24
  super
24
25
  end
25
26
  end
27
+
28
+ def self.settings_attr_accessor(*args)
29
+ args.each do |method_name|
30
+ eval "
31
+ def #{method_name}
32
+ self.settings(:core).send(:#{method_name})
33
+ end
34
+ def #{method_name}=(value)
35
+ self.settings(:core).send(:#{method_name}=, value)
36
+ end
37
+ "
38
+ end
39
+ end
40
+
41
+ settings_attr_accessor :time_zone
26
42
  end
27
43
  end
@@ -1,3 +1,3 @@
1
1
  module MyTimeline
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_timeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Aiken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-10 00:00:00.000000000 Z
11
+ date: 2014-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -139,7 +139,7 @@ files:
139
139
  - Rakefile
140
140
  - app/assets/images/my_timeline/.gitkeep
141
141
  - app/assets/images/my_timeline/icons/notes.png
142
- - app/assets/javascripts/my_timeline/application.js
142
+ - app/assets/javascripts/my_timeline/events.js.coffee
143
143
  - app/assets/stylesheets/my_timeline/application.css
144
144
  - app/controllers/my_timeline/application_controller.rb
145
145
  - app/controllers/my_timeline/control_panel_controller.rb
@@ -150,6 +150,7 @@ files:
150
150
  - app/models/my_timeline/event.rb
151
151
  - app/models/my_timeline/post.rb
152
152
  - app/presenters/my_timeline/event_presenter.rb
153
+ - app/views/my_timeline/control_panel/_time_zone.html.erb
153
154
  - app/views/my_timeline/control_panel/index.html.erb
154
155
  - app/views/my_timeline/events/_day_with_events_list.html.erb
155
156
  - app/views/my_timeline/events/_day_with_events_table.html.erb
@@ -1,15 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // the compiled file.
9
- //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require_tree .