Skip to content
Extraits de code Groupes Projets
Valider f136fa3d rédigé par Sybil's avatar Sybil
Parcourir les fichiers

Cloud for users and tags. Menu added with users,channels, tags ...

parent 48cdd369
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -42,6 +42,9 @@ function next_music() {
else if (music_info.data().player == "soundcloud" ) {
soundcloud_player();
}
else {
next_music();
}
}
function onPlayerStateChange(event) {
......
......@@ -15,9 +15,13 @@ a
padding: 2px 6px;
}
.tags{
.cloud{
color: rgba(0, 110, 140, 0.95);
}
.cloud:hover{
color: rgba(255,220,180,1);
background-color: rgba(0, 110, 140, 0.95);
}
a:hover{
background-color: rgba(255,220,180,1);
......@@ -69,6 +73,25 @@ ul
background-color: rgba(0, 110, 140, 0.8);
}
.menu {
background-color: rgba(0, 110, 140, 1);
margin: auto;
cursor: pointer;
border-radius: 12px;
width: 60%;
}
.menu a{
width: 24.55%;
padding: 15px 0;
border-radius: 12px;
display: inline-block;
font: 20px Helvetica Neue, Helvetica, Arial, sans-serif;
overflow: hidden;
vertical-align: middle;
text-align: center;
}
.music_id
{
width: 5%;
......
class ChannelsController < ApplicationController
def index_user
@users = Channel.all
def index_users
users = Channel.all
list_users = Array.new
users.each do |user|
list_users.push(user.sender_irc)
end
@usercloud = Hash.new
list_users.each do |user|
if @usercloud.key?(user)
@usercloud[user] += 1.0
else
@usercloud[user] = 1.0
end
end
max_weight = @usercloud.values.max
@usercloud.each do |user, occ|
@usercloud[user] = occ / max_weight
end
respond_to do |format|
format.html
end
end
def index
channels = Channel.all
list_channels = Array.new
channels.each do |channel|
list_channels.push(channel.chan)
end
@channels = Array.new
list_channels.each do |channel|
if @channels.include?(channel) == false
@channels.push(channel)
end
end
respond_to do |format|
format.html
......
......@@ -19,8 +19,12 @@ class TagsController < ApplicationController
max_weight = @tagcloud.values.max
@tagcloud.each do |tag, occ|
if occ == 1
@tagcloud.delete(tag)
else
@tagcloud[tag] = occ / max_weight
end
end
respond_to do |format|
format.html
......
<ul>
<% @channels.each do |channel| %>
<li><%= link_to channel, '/musics/channels/'+channel.sub('#',''), class: "cloud" %></li>
<% end %>
</ul>
<% @usercloud.each do |user,weight| %>
<%= link_to user, '/musics/users/'+user, style: "font-size:"+(15+weight*200).to_s+"px", class: "cloud" %>
<% end %>
Aucun aperçu pour ce type de fichier
......@@ -6,6 +6,14 @@
<%= csrf_meta_tags %>
</head>
<body>
<ul>
<li class="menu">
<span><a href="/musics">Home</a></span>
<span><a href="/channels">Channels</a></span>
<span><a href="/users">Users</a></span>
<span><a href="/tags">Tags</a></span>
</li>
</ul>
<div id="player_position">
<div id="player_block"></div>
</div>
......
Aucun aperçu pour ce type de fichier
<% @tagcloud.each do |tag,weight| %>
<%= link_to raw("<span class=\"tags\" style=\"font-size:"+(15+weight*200).to_s+"px\">"+tag+"</span>"), '/musics/tags/'+tag %>
<%= link_to tag, '/musics/tags/'+tag, style: "font-size:"+(15+weight*200).to_s+"px", class: "cloud" %>
<% end %>
......@@ -62,4 +62,5 @@ Rails.application.routes.draw do
get '/musics/tags/:tag', to: "tags#show"
get '/musics/users/:user', to: "channels#show_user"
get '/musics/channels/:channel', to: "channels#show_channel"
get '/users', to: "channels#index_users"
end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter