mix-rails-songs 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +27 -0
- data/app/controllers/admix/songs_controller.rb +3 -0
- data/app/controllers/songs_controller.rb +16 -0
- data/app/models/admix/songs_datagrid.rb +20 -0
- data/app/models/song.rb +19 -0
- data/app/uploaders/songs/song_uploader.rb +60 -0
- data/app/views/admix/songs/_form_fields.html.haml +4 -0
- data/app/views/admix/songs/_show.html.haml +12 -0
- data/app/views/admix/songs/_table_actions.html.haml +3 -0
- data/app/views/songs/player.haml +99 -0
- data/config/locales/songs.pt-BR.yml +4 -0
- data/config/routes.rb +15 -0
- data/lib/mix-rails-songs.rb +4 -0
- data/lib/mix-rails-songs/engine.rb +19 -0
- data/lib/mix-rails-songs/version.rb +10 -0
- data/lib/tasks/songs_tasks.rake +4 -0
- metadata +85 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'Songs'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Admix::SongsDatagrid
|
2
|
+
|
3
|
+
include Datagrid
|
4
|
+
|
5
|
+
extend AdmixHelper
|
6
|
+
|
7
|
+
scope do
|
8
|
+
Song.desc(:date)
|
9
|
+
end
|
10
|
+
|
11
|
+
column :title, header: input_label(:songs, :title)
|
12
|
+
column :author, header: input_label(:songs, :author)
|
13
|
+
|
14
|
+
column :status, header: input_label(:songs, :status) do |record|
|
15
|
+
record.status.text
|
16
|
+
end
|
17
|
+
|
18
|
+
include Admix::TableActions
|
19
|
+
|
20
|
+
end
|
data/app/models/song.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
class Song
|
2
|
+
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
extend Enumerize
|
6
|
+
|
7
|
+
field :title, type: String
|
8
|
+
field :author, type: String
|
9
|
+
field :status, type: String
|
10
|
+
enumerize :status, in: [:published, :unpublished], default: :published, predicates: true
|
11
|
+
|
12
|
+
mount_uploader :mp3, Songs::SongUploader
|
13
|
+
|
14
|
+
validates_presence_of :name
|
15
|
+
validates_presence_of :author
|
16
|
+
|
17
|
+
scope :published, where(status: :published)
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'carrierwave/processing/mini_magick'
|
3
|
+
|
4
|
+
class Songs::SongUploader < CarrierWave::Uploader::Base
|
5
|
+
|
6
|
+
# Include RMagick or MiniMagick support:
|
7
|
+
# include CarrierWave::RMagick
|
8
|
+
#include CarrierWave::MiniMagick
|
9
|
+
|
10
|
+
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
|
11
|
+
include Sprockets::Helpers::RailsHelper
|
12
|
+
include Sprockets::Helpers::IsolatedHelper
|
13
|
+
|
14
|
+
# Choose what kind of storage to use for this uploader:
|
15
|
+
storage :grid_fs
|
16
|
+
# storage :fog
|
17
|
+
|
18
|
+
# Override the directory where uploaded files will be stored.
|
19
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
20
|
+
def store_dir
|
21
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def cache_dir
|
25
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
26
|
+
end
|
27
|
+
|
28
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
29
|
+
# def default_url
|
30
|
+
# # For Rails 3.1+ asset pipeline compatibility:
|
31
|
+
# # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
32
|
+
#
|
33
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
34
|
+
# end
|
35
|
+
|
36
|
+
# Process files as they are uploaded:
|
37
|
+
# process :scale => [200, 300]
|
38
|
+
#
|
39
|
+
# def scale(width, height)
|
40
|
+
# # do something
|
41
|
+
# end
|
42
|
+
|
43
|
+
# Create different versions of your uploaded files:
|
44
|
+
# version :thumb do
|
45
|
+
# process :resize_to_fit => [80, 80]
|
46
|
+
# end
|
47
|
+
|
48
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
49
|
+
# For images you might use something like this:
|
50
|
+
# def extension_white_list
|
51
|
+
# %w(jpg jpeg gif png)
|
52
|
+
# end
|
53
|
+
|
54
|
+
# Override the filename of the uploaded files:
|
55
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
56
|
+
# def filename
|
57
|
+
# "something.jpg" if original_filename
|
58
|
+
# end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
%dl
|
2
|
+
%dt= input_label(:songs, :title)
|
3
|
+
%dd= resource.title
|
4
|
+
|
5
|
+
%dt= input_label(:songs, :author)
|
6
|
+
%dd= resource.author
|
7
|
+
|
8
|
+
%dt= input_label(:songs, :mp3)
|
9
|
+
%dd= link_to resource.mp3.url, resource.mp3.url
|
10
|
+
|
11
|
+
%dt= input_label(:songs, :status)
|
12
|
+
%dd= resource.status.text
|
@@ -0,0 +1,3 @@
|
|
1
|
+
= link_to image_tag('admix/zoom.png'), resource_url(resource), class: 'btn', title:'Visualizar registro'
|
2
|
+
= link_to image_tag('admix/page_edit.png'), edit_resource_url(resource), class: 'btn', title:'Editar registro'
|
3
|
+
= link_to image_tag('admix/cancel.png'), resource_url(resource), method: :delete, data: { confirm: t('admix.crud.destroy_confirm') }, class: 'btn', title:'Deletar registro'
|
@@ -0,0 +1,99 @@
|
|
1
|
+
= javascript_include_tag 'underscore'
|
2
|
+
= javascript_include_tag 'jquery'
|
3
|
+
= javascript_include_tag 'jquery/jquery.livequery'
|
4
|
+
= javascript_include_tag 'jplayer'
|
5
|
+
= stylesheet_link_tag 'jplayer/jplayer.pink.flag'
|
6
|
+
|
7
|
+
:coffeescript
|
8
|
+
|
9
|
+
window.pause = ->
|
10
|
+
$("#jp-pause").click()
|
11
|
+
window.play = ->
|
12
|
+
$("#jp-play").click()
|
13
|
+
window.next = ->
|
14
|
+
$("#jp-next").click()
|
15
|
+
window.previous = ->
|
16
|
+
$("#jp-previous").click()
|
17
|
+
|
18
|
+
window.play_pause = ->
|
19
|
+
if $(".jp-pause").is(':visible')
|
20
|
+
pause()
|
21
|
+
else
|
22
|
+
play()
|
23
|
+
|
24
|
+
window.bindPlayer = (_window) ->
|
25
|
+
if _window?
|
26
|
+
$("#jquery_jplayer_1").bind $.jPlayer.event.play, (event, par2) ->
|
27
|
+
$("#musica-nome", _window.document).text event.jPlayer.status.media.title
|
28
|
+
|
29
|
+
$("#jquery_jplayer_1").bind $.jPlayer.event.pause, (event, par2) ->
|
30
|
+
|
31
|
+
$.getJSON "#{songs_path(:json)}", (songs) =>
|
32
|
+
new jPlayerPlaylist(
|
33
|
+
jPlayer: "#jquery_jplayer_1"
|
34
|
+
cssSelectorAncestor: "#jp_container_1"
|
35
|
+
, _.map(songs, (s) ->
|
36
|
+
s.title = s.title + " - " + s.author
|
37
|
+
s.mp3 = s.mp3.url
|
38
|
+
s),
|
39
|
+
swfPath: "#{asset_path('jquery.jplayer')}"
|
40
|
+
supplied: "mp3"
|
41
|
+
wmode: "window"
|
42
|
+
solution: "html, flash"
|
43
|
+
loop: true
|
44
|
+
ready: ->
|
45
|
+
$(this).jPlayer "play"
|
46
|
+
)
|
47
|
+
|
48
|
+
bindPlayer(parent.mainFrame)
|
49
|
+
|
50
|
+
#$("#jplayer_inspector").jPlayerInspector jPlayer: $("#jquery_jplayer_1")
|
51
|
+
|
52
|
+
.container
|
53
|
+
.row
|
54
|
+
.span16.pull-right
|
55
|
+
#jquery_jplayer_1
|
56
|
+
#jp_container_1.jp-audio
|
57
|
+
.jp-type-playlist
|
58
|
+
.jp-gui.jp-interface
|
59
|
+
%ul.jp-controls
|
60
|
+
%li
|
61
|
+
%a#jp-previous.jp-previous{:href => "javascript:;", :tabindex => "1"} previous
|
62
|
+
%li
|
63
|
+
%a#jp-play.jp-play{:href => "javascript:;", :tabindex => "1"} play
|
64
|
+
%li
|
65
|
+
%a#jp-pause.jp-pause{:href => "javascript:;", :tabindex => "1"} pause
|
66
|
+
%li
|
67
|
+
%a#jp-next.jp-next{:href => "javascript:;", :tabindex => "1"} next
|
68
|
+
%li
|
69
|
+
%a.jp-stop{:href => "javascript:;", :tabindex => "1"} stop
|
70
|
+
%li
|
71
|
+
%a.jp-mute{:href => "javascript:;", :tabindex => "1", :title => "mute"} mute
|
72
|
+
%li
|
73
|
+
%a.jp-unmute{:href => "javascript:;", :tabindex => "1", :title => "unmute"} unmute
|
74
|
+
%li
|
75
|
+
%a.jp-volume-max{:href => "javascript:;", :tabindex => "1", :title => "max volume"} max volume
|
76
|
+
.jp-progress
|
77
|
+
.jp-seek-bar
|
78
|
+
.jp-play-bar
|
79
|
+
.jp-volume-bar
|
80
|
+
.jp-volume-bar-value
|
81
|
+
.jp-current-time
|
82
|
+
.jp-duration
|
83
|
+
%ul.jp-toggles
|
84
|
+
%li
|
85
|
+
%a.jp-shuffle{:href => "javascript:;", :tabindex => "1", :title => "shuffle"} shuffle
|
86
|
+
%li
|
87
|
+
%a.jp-shuffle-off{:href => "javascript:;", :tabindex => "1", :title => "shuffle off"} shuffle off
|
88
|
+
%li
|
89
|
+
%a.jp-repeat{:href => "javascript:;", :tabindex => "1", :title => "repeat"} repeat
|
90
|
+
%li
|
91
|
+
%a.jp-repeat-off{:href => "javascript:;", :tabindex => "1", :title => "repeat off"} repeat off
|
92
|
+
.jp-playlist
|
93
|
+
%ul
|
94
|
+
%li
|
95
|
+
.jp-no-solution
|
96
|
+
%span Update Required
|
97
|
+
To play the media you will need to either update your browser to a recent version or update your
|
98
|
+
= succeed "." do
|
99
|
+
%a{:href => "http://get.adobe.com/flashplayer/", :target => "_blank"} Flash plugin
|
data/config/routes.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module MixRailsSongs
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
|
4
|
+
def navigation
|
5
|
+
if defined? Admix
|
6
|
+
Admix::Navigation::NavBar.post_menu do
|
7
|
+
Admix::Navigation::NavBar.find(:content) do |menu|
|
8
|
+
menu.submenu do |submenu|
|
9
|
+
submenu.key = :songs
|
10
|
+
submenu.title = I18n.t 'songs.songs'
|
11
|
+
submenu.url = 'admix_songs_url'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mix-rails-songs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.10.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Sadjow Medeiros Leão
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.11
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.11
|
30
|
+
description: Songs module for mix-rails
|
31
|
+
email:
|
32
|
+
- sadjow@gmail.com
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- app/uploaders/songs/song_uploader.rb
|
38
|
+
- app/controllers/admix/songs_controller.rb
|
39
|
+
- app/controllers/songs_controller.rb
|
40
|
+
- app/models/admix/songs_datagrid.rb
|
41
|
+
- 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
|
47
|
+
- config/routes.rb
|
48
|
+
- lib/tasks/songs_tasks.rake
|
49
|
+
- lib/mix-rails-songs/version.rb
|
50
|
+
- lib/mix-rails-songs/engine.rb
|
51
|
+
- lib/mix-rails-songs.rb
|
52
|
+
- MIT-LICENSE
|
53
|
+
- Rakefile
|
54
|
+
- README.rdoc
|
55
|
+
homepage: https://github.com/mixinternet/mix-rails
|
56
|
+
licenses: []
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
hash: 656486252467569342
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
hash: 656486252467569342
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 1.8.24
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Songs module for mix-rails
|
85
|
+
test_files: []
|