mix-rails-songs 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  class SongsController < ApplicationController
2
-
2
+
3
3
  def index
4
4
 
5
5
  @songs = Song.published.all
@@ -7,9 +7,22 @@ class SongsController < ApplicationController
7
7
  respond_to do |format|
8
8
  format.json { render json: @songs }
9
9
  end
10
+
11
+ end
12
+
13
+ def shuffled
14
+
15
+ @songs = Song.published.all.shuffle
16
+
17
+ respond_to do |format|
18
+ format.json { render json: @songs }
19
+ end
20
+
10
21
  end
11
22
 
12
23
  def player
24
+ @shuffled = params[:shuffled] || false
25
+ @songs_api = @shuffled ? shuffled_songs_path(:json) : songs_path(:json)
13
26
  render layout: false
14
27
  end
15
28
 
@@ -28,7 +28,7 @@
28
28
 
29
29
  $("#jquery_jplayer_1").bind $.jPlayer.event.pause, (event, par2) ->
30
30
 
31
- $.getJSON "#{songs_path(:json)}", (songs) =>
31
+ $.getJSON "#{@songs_api}", (songs) =>
32
32
  new jPlayerPlaylist(
33
33
  jPlayer: "#jquery_jplayer_1"
34
34
  cssSelectorAncestor: "#jp_container_1"
data/config/routes.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
3
  localized do
4
- resources :songs do
4
+ resources :songs do
5
5
  collection do
6
6
  get :player
7
+ get :shuffled
7
8
  end
8
9
  end
9
10
  end
@@ -1,7 +1,7 @@
1
1
  module MixRailsSongs
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 15
4
+ MINOR = 16
5
5
  TINY = 0
6
6
  PRE = nil
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mix-rails-songs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-24 00:00:00.000000000 Z
12
+ date: 2013-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -34,21 +34,21 @@ executables: []
34
34
  extensions: []
35
35
  extra_rdoc_files: []
36
36
  files:
37
- - app/uploaders/songs/song_uploader.rb
37
+ - app/views/admix/songs/_form_fields.html.haml
38
+ - app/views/admix/songs/_table_actions.html.haml
39
+ - app/views/admix/songs/_show.html.haml
40
+ - app/views/songs/player.haml
38
41
  - app/controllers/admix/songs_controller.rb
39
42
  - app/controllers/songs_controller.rb
40
- - app/models/admix/songs_datagrid.rb
41
43
  - app/models/song.rb
42
- - app/views/admix/songs/_show.html.haml
43
- - app/views/admix/songs/_table_actions.html.haml
44
- - app/views/admix/songs/_form_fields.html.haml
45
- - app/views/songs/player.haml
46
- - config/locales/songs.pt-BR.yml
44
+ - app/models/admix/songs_datagrid.rb
45
+ - app/uploaders/songs/song_uploader.rb
47
46
  - config/routes.rb
47
+ - config/locales/songs.pt-BR.yml
48
+ - lib/mix-rails-songs.rb
48
49
  - lib/tasks/songs_tasks.rake
49
50
  - lib/mix-rails-songs/version.rb
50
51
  - lib/mix-rails-songs/engine.rb
51
- - lib/mix-rails-songs.rb
52
52
  - MIT-LICENSE
53
53
  - Rakefile
54
54
  - README.rdoc
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  segments:
68
68
  - 0
69
- hash: 1008765679201104356
69
+ hash: 1995139474515889120
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements:
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  segments:
77
77
  - 0
78
- hash: 1008765679201104356
78
+ hash: 1995139474515889120
79
79
  requirements: []
80
80
  rubyforge_project:
81
81
  rubygems_version: 1.8.24