odania_timeline 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0c966af669fc708871744d7416c17dee99ff81b
4
- data.tar.gz: 8855e8dd7d3b8397077c869db45e0a5d3c2e3394
3
+ metadata.gz: 26a3e0ab5ab497daa61bcbf8dc6a9fe8e04321fc
4
+ data.tar.gz: 2bfb6cc81ef122eb570d90379a25319eab536589
5
5
  SHA512:
6
- metadata.gz: 43597605c638e300a39ad7d69be39e62a1c6119de06db748d03bc924c32cebfb09db3f3df282885a71ae82788dc5982b1372f8cf57d8078ae31f602464f44702
7
- data.tar.gz: 9afba8aae677dc897a3dfdeb98a740a94a88a8d8ac20ba09ee666ad2c8a13a68c526989f8a0ee3105ff79b95468d84af561c196f29dee537a03376b543abd8fb
6
+ metadata.gz: 052d59f66ac165244ab2d519d4d334fec16b701c1f6e369ccc85f5687ae8e688bb11b19534e55ad94fa1e0131331bd3b3b2db94071db5e83928c113298ac22b7
7
+ data.tar.gz: eb1dc3a9d40774d3a64977ba19a069f31b8b5cff0e10a1017299bf8d6905c2cd2bb5590284bd5d523f5e980fbea70402736323a2f147c02afd448063294378db
data/README.rdoc CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  Odania Timeline is aplugin for the Odania Portal. It gives you the possibility to define and display timelines.
4
4
 
5
- Active the plugin "odania_timeline" in the admin tool for a site. Afterwords you can define the data in the protected area.
5
+ Active the plugin "odania_timeline" in the admin tool for a site. Afterwords users can define the data in the protected area.
6
6
 
7
7
  This project rocks and uses MIT-LICENSE.
@@ -9,7 +9,8 @@ app.controller('OdaniaTimelineEditTimelineController', ['$location', '$scope', '
9
9
  var contents;
10
10
  for (var i=0 ; i<$scope.timeline.timeline_contents.length ; i++) {
11
11
  contents = $scope.timeline.timeline_contents[i];
12
- contents.timeline_date = new Date(parseInt(contents.timeline_date));
12
+ contents.from_date = new Date(parseInt(contents.from_date));
13
+ contents.to_date = new Date(parseInt(contents.to_date));
13
14
  }
14
15
  });
15
16
  }
@@ -1,4 +1,6 @@
1
1
  class OdaniaTimeline::TimelinesController < ApplicationController
2
+ before_action :valid_site!
3
+
2
4
  def index
3
5
  @timelines = OdaniaTimeline::Timeline.where(is_public: true).order('updated_at DESC')
4
6
  end
@@ -46,6 +46,6 @@ class Protected::Api::OdaniaTimeline::TimelinesController < Protected::ApiContro
46
46
  end
47
47
 
48
48
  def timeline_params
49
- params.require(:timeline).permit(:title, :is_public, timeline_contents_attributes: [:id, :title, :body, :timeline_date])
49
+ params.require(:timeline).permit(:title, :is_public, timeline_contents_attributes: [:id, :title, :body, :from_date, :to_date])
50
50
  end
51
51
  end
@@ -3,5 +3,5 @@ class OdaniaTimeline::TimelineContent < ActiveRecord::Base
3
3
 
4
4
  validates_length_of :title, minimum: 2
5
5
  validates_length_of :body, minimum: 5
6
- validates_presence_of :timeline_date
6
+ validates_presence_of :from_date
7
7
  end
@@ -1,9 +1,14 @@
1
1
  <h2 class="right-line"><%= timeline.title %></h2>
2
2
 
3
3
  <ul class="timeline-2">
4
- <% timeline.timeline_contents.each do |timeline_content| %>
4
+ <% timeline.timeline_contents.order('from_date DESC').each do |timeline_content| %>
5
5
  <li class="wow fadeInRight">
6
- <time class="timeline-time" datetime=""><%= timeline_content.timeline_date %></time>
6
+ <time class="timeline-time" datetime="">
7
+ <%=l timeline_content.from_date %>
8
+ <% unless timeline_content.to_date.nil? %>
9
+ - <%=l timeline_content.to_date %>
10
+ <% end %>
11
+ </time>
7
12
  <i class="timeline-2-point"></i>
8
13
 
9
14
  <div class="panel panel-default">
@@ -1,4 +1,5 @@
1
1
  json.id timeline_content.id
2
- json.timeline_date date_to_time_since_epoch(timeline_content.timeline_date)
2
+ json.from_date date_to_time_since_epoch(timeline_content.from_date)
3
+ json.to_date date_to_time_since_epoch(timeline_content.to_date)
3
4
  json.title timeline_content.title
4
5
  json.body timeline_content.body
@@ -3,4 +3,4 @@ json.title timeline.title
3
3
  json.language_id timeline.language_id
4
4
  json.is_public timeline.is_public
5
5
 
6
- json.timeline_contents timeline.timeline_contents, partial: 'protected/api/odania_timeline/timeline_contents/show', as: :timeline_content
6
+ json.timeline_contents timeline.timeline_contents.order('from_date DESC'), partial: 'protected/api/odania_timeline/timeline_contents/show', as: :timeline_content
@@ -1,5 +1,5 @@
1
1
  <div class="field">
2
- <label>Contact List</label>
2
+ <label>Timeline</label>
3
3
  <select data-ng-model="targetData.id" data-ng-options="timeline.id as timeline.title for timeline in data.timelines"></select>
4
4
  <br/>
5
5
  </div>
@@ -17,11 +17,20 @@
17
17
  <legend>Timeline Content {{ $index + 1 }}</legend>
18
18
 
19
19
  <div class="form-group">
20
- <label class="col-sm-2 control-label">Date</label>
20
+ <label class="col-sm-2 control-label">Start Date</label>
21
21
 
22
22
  <div class="col-sm-10">
23
- <input type="date" data-ng-model="timeline.timeline_contents[$index].timeline_date" placeholder="Release date" class="form-control"/>
24
- <span data-ng-if="errors.timeline_contents[$index].timeline_date" style="color: red;">{{ printErrors(errors.timeline_contents[$index].timeline_date) }}</span>
23
+ <input type="date" data-ng-model="timeline.timeline_contents[$index].from_date" placeholder="Start date" class="form-control"/>
24
+ <span data-ng-if="errors.timeline_contents[$index].from_date" style="color: red;">{{ printErrors(errors.timeline_contents[$index].from_date) }}</span>
25
+ </div>
26
+ </div>
27
+
28
+ <div class="form-group">
29
+ <label class="col-sm-2 control-label">End Date</label>
30
+
31
+ <div class="col-sm-10">
32
+ <input type="date" data-ng-model="timeline.timeline_contents[$index].to_date" placeholder="Start date" class="form-control"/>
33
+ <span data-ng-if="errors.timeline_contents[$index].to_date" style="color: red;">{{ printErrors(errors.timeline_contents[$index].to_date) }}</span>
25
34
  </div>
26
35
  </div>
27
36
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  <div data-ng-repeat="timelineContent in timeline.timeline_contents">
12
12
  <hr/>
13
- <strong>{{ timelineContent.timeline_date }}: {{ timelineContent.title }}</strong>
13
+ <strong>{{ timelineContent.from_date }} - {{ timelineContent.to_date }}: {{ timelineContent.title }}</strong>
14
14
  <div data-ng-html="{{ timelineContent.body }}"></div>
15
15
  </div>
16
16
 
@@ -0,0 +1,6 @@
1
+ class AddDateColumn < ActiveRecord::Migration
2
+ def change
3
+ rename_column :odania_timeline_timeline_contents, :timeline_date, :from_date
4
+ add_column :odania_timeline_timeline_contents, :to_date, :date
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module OdaniaTimeline
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odania_timeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Petersen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-30 00:00:00.000000000 Z
11
+ date: 2015-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,6 +80,7 @@ files:
80
80
  - config/routes.rb
81
81
  - db/migrate/20150327172503_create_odania_timeline_timelines.rb
82
82
  - db/migrate/20150327172813_create_odania_timeline_timeline_contents.rb
83
+ - db/migrate/20150401192045_add_date_column.rb
83
84
  - lib/odania_timeline.rb
84
85
  - lib/odania_timeline/engine.rb
85
86
  - lib/odania_timeline/engine_target_type.rb