Browse Source

Evolution #164: Proposition de tag sur un élément

bastien 13 years ago
parent
commit
1bc5c07f27

+ 4 - 0
app/Resources/translations/users.fr.yml View File

25
     no:                         Pas de nouveaux utilisateurs qui vous suivent
25
     no:                         Pas de nouveaux utilisateurs qui vous suivent
26
     one:                        %count% nouvel utilisateur vous suis
26
     one:                        %count% nouvel utilisateur vous suis
27
     yes:                        %count% nouveaux utilisateurs vous suivent
27
     yes:                        %count% nouveaux utilisateurs vous suivent
28
+  new_tags:
29
+    no:                         Pas de nouvelle proposition de tags
30
+    one:                        %count% nouveau partage avec proposition de tags
31
+    yes:                        %count% nouveaux partages avec proposition de tags
28
     
32
     
29
 reputation:
33
 reputation:
30
   bar:
34
   bar:

+ 1 - 0
app/Resources/translations/userui.fr.yml View File

67
   network_my:    Mon réseau
67
   network_my:    Mon réseau
68
   new_comments:     Nvx commentaires
68
   new_comments:     Nvx commentaires
69
   new_favoriteds:   Nvx favoris
69
   new_favoriteds:   Nvx favoris
70
+  new_tags:         Propositions de tags
70
   
71
   
71
 element_add:
72
 element_add:
72
   url:
73
   url:

+ 1 - 0
src/Muzich/CoreBundle/Controller/CoreController.php View File

615
     
615
     
616
     $es = $this->getElementSearcher();
616
     $es = $this->getElementSearcher();
617
     $es->setIds(null);
617
     $es->setIds(null);
618
+    $es->setIdsDisplay(null);
618
     $this->setElementSearcherParams($es->getParams());
619
     $this->setElementSearcherParams($es->getParams());
619
     
620
     
620
     $html = $this->render('MuzichCoreBundle:SearchElement:default.html.twig', array(
621
     $html = $this->render('MuzichCoreBundle:SearchElement:default.html.twig', array(

+ 14 - 0
src/Muzich/CoreBundle/Controller/ElementController.php View File

553
       ));
553
       ));
554
     }
554
     }
555
     
555
     
556
+    // On ne doit pas pouvoir proposer de tags sur son propre élément
557
+    if ($element->getOwner()->getId() == $this->getUserId())
558
+    {
559
+      return $this->jsonResponse(array(
560
+        'status' => 'error',
561
+        'errors' => array('NotAllowed')
562
+      ));
563
+    }
564
+    
556
     $values   = $this->getRequest()->request->get('element_tag_proposition_'.$element->getId());
565
     $values   = $this->getRequest()->request->get('element_tag_proposition_'.$element->getId());
557
     $tags_ids = json_decode($values['tags'], true);
566
     $tags_ids = json_decode($values['tags'], true);
558
     
567
     
597
     
606
     
598
     $this->getDoctrine()->getEntityManager()->persist($element);
607
     $this->getDoctrine()->getEntityManager()->persist($element);
599
     $this->getDoctrine()->getEntityManager()->persist($proposition);
608
     $this->getDoctrine()->getEntityManager()->persist($proposition);
609
+    
610
+    // Notifs etc 
611
+    $event = new EventElement($this->container);
612
+    $event->tagsProposed($element);
613
+    
600
     $this->getDoctrine()->getEntityManager()->flush();
614
     $this->getDoctrine()->getEntityManager()->flush();
601
     
615
     
602
     return $this->jsonResponse(array(
616
     return $this->jsonResponse(array(

+ 1 - 0
src/Muzich/CoreBundle/Entity/Event.php View File

21
   const TYPE_COMMENT_ADDED_ELEMENT = "com.adde.ele";
21
   const TYPE_COMMENT_ADDED_ELEMENT = "com.adde.ele";
22
   const TYPE_FAV_ADDED_ELEMENT     = "fav.adde.ele";
22
   const TYPE_FAV_ADDED_ELEMENT     = "fav.adde.ele";
23
   const TYPE_USER_FOLLOW           = "user.follow";
23
   const TYPE_USER_FOLLOW           = "user.follow";
24
+  const TYPE_TAGS_PROPOSED         = "tags.prop.ad";
24
   
25
   
25
   /**
26
   /**
26
    * @ORM\Id
27
    * @ORM\Id

+ 3 - 0
src/Muzich/CoreBundle/Extension/MyTwigExtension.php View File

131
       case 'TYPE_USER_FOLLOW':
131
       case 'TYPE_USER_FOLLOW':
132
         return Event::TYPE_USER_FOLLOW;
132
         return Event::TYPE_USER_FOLLOW;
133
       break;
133
       break;
134
+      case 'TYPE_TAGS_PROPOSED':
135
+        return Event::TYPE_TAGS_PROPOSED;
136
+      break;
134
       default:
137
       default:
135
         throw new \Exception('Constante non géré dans MyTwigExtension::event_const');
138
         throw new \Exception('Constante non géré dans MyTwigExtension::event_const');
136
       break;
139
       break;

+ 12 - 0
src/Muzich/CoreBundle/Propagator/EventElement.php View File

124
     );
124
     );
125
   }
125
   }
126
   
126
   
127
+  /**
128
+   * Des tags viennent d'être proposé a un élément
129
+   *
130
+   * @param Element $element 
131
+   */
132
+  public function tagsProposed(Element $element)
133
+  {
134
+    $uea = new UserEventAction($element->getOwner(), $this->container);
135
+    $event = $uea->proceed(Event::TYPE_TAGS_PROPOSED, $element->getId());
136
+    $this->container->get('doctrine')->getEntityManager()->persist($event);
137
+  }
138
+  
127
 }
139
 }

+ 10 - 0
src/Muzich/CoreBundle/Resources/views/SearchElement/form.html.twig View File

17
   </div>
17
   </div>
18
 
18
 
19
   <div class="more_filters">
19
   <div class="more_filters">
20
+    
20
     <a href="{{ path('ajax_filter_remove_ids') }}" class="button active new_comments" 
21
     <a href="{{ path('ajax_filter_remove_ids') }}" class="button active new_comments" 
21
        style="{% if ids_display != event_const('TYPE_COMMENT_ADDED_ELEMENT') %}display: none;{% endif %}"
22
        style="{% if ids_display != event_const('TYPE_COMMENT_ADDED_ELEMENT') %}display: none;{% endif %}"
22
     >
23
     >
23
       {{ 'filter.new_comments'|trans({}, 'userui') }}
24
       {{ 'filter.new_comments'|trans({}, 'userui') }}
24
       <img src="{{ asset('bundles/muzichcore/img/1328276855_list-remove.png') }}" alt="remove" />
25
       <img src="{{ asset('bundles/muzichcore/img/1328276855_list-remove.png') }}" alt="remove" />
25
     </a>
26
     </a>
27
+      
26
     <a href="{{ path('ajax_filter_remove_ids') }}" class="button active new_favorites" 
28
     <a href="{{ path('ajax_filter_remove_ids') }}" class="button active new_favorites" 
27
        style="{% if ids_display != event_const('TYPE_FAV_ADDED_ELEMENT') %}display: none;{% endif %}"
29
        style="{% if ids_display != event_const('TYPE_FAV_ADDED_ELEMENT') %}display: none;{% endif %}"
28
     >
30
     >
29
       {{ 'filter.new_favoriteds'|trans({}, 'userui') }}
31
       {{ 'filter.new_favoriteds'|trans({}, 'userui') }}
30
       <img src="{{ asset('bundles/muzichcore/img/1328276855_list-remove.png') }}" alt="remove" />
32
       <img src="{{ asset('bundles/muzichcore/img/1328276855_list-remove.png') }}" alt="remove" />
31
     </a>
33
     </a>
34
+      
35
+    <a href="{{ path('ajax_filter_remove_ids') }}" class="button active new_tags" 
36
+       style="{% if ids_display != event_const('TYPE_TAGS_PROPOSED') %}display: none;{% endif %}"
37
+    >
38
+      {{ 'filter.new_tags'|trans({}, 'userui') }}
39
+      <img src="{{ asset('bundles/muzichcore/img/1328276855_list-remove.png') }}" alt="remove" />
40
+    </a>
41
+    
32
   </div>
42
   </div>
33
   
43
   
34
   {% include "MuzichCoreBundle:Tag:tagsPrompt.html.twig" with { 
44
   {% include "MuzichCoreBundle:Tag:tagsPrompt.html.twig" with { 

+ 18 - 0
src/Muzich/UserBundle/Resources/views/Info/bar.html.twig View File

59
         {% endif %}
59
         {% endif %}
60
           
60
           
61
     </div>
61
     </div>
62
+    
63
+    <div class="tags">
64
+      
65
+        {% if events[event_const('TYPE_TAGS_PROPOSED')] is defined %}
66
+          <a 
67
+            href="{{ path('event_view_elements', {'event_id':events[event_const('TYPE_TAGS_PROPOSED')].id}) }}" 
68
+            title="{%if events[event_const('TYPE_TAGS_PROPOSED')].count == 1 %}{{ 'events.new_tags.one'|trans({'%count%':1}, 'users') }}{% else %}{{ 'events.new_tags.yes'|trans({'%count%':events[event_const('TYPE_TAGS_PROPOSED')].count}, 'users') }}{% endif %}"
69
+            class="view_follows_event"
70
+          >
71
+            <img src="{{ asset('bundles/muzichcore/img/1333484018_rss-tag.png') }}" alt="tags" />
72
+            <span class="new_follows">{{ events[event_const('TYPE_TAGS_PROPOSED')].count }}</span>
73
+          </a>
74
+        {% else %}
75
+          <img title="{{ 'events.new_tags.no'|trans({}, 'users') }}" src="{{ asset('bundles/muzichcore/img/1333484018_rss-tag.png') }}" alt="tags" />
76
+          <span class="new_follows">0</span>
77
+        {% endif %}
78
+          
79
+    </div>
62
   
80
   
63
   
81
   
64
   </div>
82
   </div>

+ 12 - 0
web/bundles/muzichcore/css/main.css View File

1168
   margin-left: 5px;
1168
   margin-left: 5px;
1169
 }
1169
 }
1170
 
1170
 
1171
+div#events div.tags img
1172
+{
1173
+  margin-left: 3px;
1174
+  margin-bottom: -2px;
1175
+}
1176
+
1177
+div#events div.tags span
1178
+{
1179
+  font-weight: bold;
1180
+  margin-left: 5px;
1181
+}
1182
+
1171
 /*
1183
 /*
1172
 * css mynetwork
1184
 * css mynetwork
1173
 */
1185
 */

+ 1 - 1
web/bundles/muzichcore/js/muzich.js View File

1685
   
1685
   
1686
   
1686
   
1687
   // Enlever les ids du ElementSearch
1687
   // Enlever les ids du ElementSearch
1688
-  $('div.more_filters a.new_comments, div.more_filters a.new_favorites').live('click', function(){
1688
+  $('div.more_filters a.new_comments, div.more_filters a.new_favorites, div.more_filters a.tags').live('click', function(){
1689
     
1689
     
1690
     $('img.elements_more_loader').show();
1690
     $('img.elements_more_loader').show();
1691
     $('ul.elements').html('');
1691
     $('ul.elements').html('');

+ 10 - 1
web/bundles/muzichhome/css/home.css View File

94
   background-position: 2px 3px;
94
   background-position: 2px 3px;
95
 }
95
 }
96
 
96
 
97
-div.more_filters a.new_comments img, div.more_filters a.new_favorites img
97
+div.more_filters a.new_tags
98
+{
99
+  margin-top: 5px;
100
+  padding-left: 20px;
101
+  background-image: url(/bundles/muzichcore/img/1333484018_rss-tag.png);
102
+  background-repeat: no-repeat;
103
+  background-position: 2px 3px;
104
+}
105
+
106
+div.more_filters a.new_comments img, div.more_filters a.new_favorites img, div.more_filters a.new_tags img
98
 {
107
 {
99
   margin-bottom: -3px;
108
   margin-bottom: -3px;
100
 }
109
 }