Parcourir la source

Début de la mise en place de la page igframe pour ajout de partage

Bastien Sevajol il y a 11 ans
Parent
révision
fd45ba7461

+ 1 - 1
src/Muzich/CoreBundle/Controller/CoreController.php Voir le fichier

@@ -662,7 +662,7 @@ class CoreController extends Controller
662 662
    */
663 663
   public function shareFromAction(Request $request)
664 664
   {
665
-    return $this->redirect($this->generateUrl('home', array(
665
+    return $this->redirect($this->generateUrl('share_from', array(
666 666
       'from_url' => $request->get('from_url'),
667 667
       // On ne se préoccupe pas de la locale coté plugins/applications
668 668
       '_locale'  => $this->determineLocale()

+ 11 - 0
src/Muzich/CoreBundle/Controller/ElementController.php Voir le fichier

@@ -1208,4 +1208,15 @@ class ElementController extends Controller
1208 1208
     ));
1209 1209
   }
1210 1210
   
1211
+  public function shareFromAction(Request $request)
1212
+  {
1213
+    if (!$request->get('from_url'))
1214
+      throw $this->createNotFoundException();
1215
+    
1216
+    return $this->render('MuzichCoreBundle:Element:share_from.html.twig', array(
1217
+      'add_form' => $this->getAddForm()->createView(),
1218
+      'from_url' => $request->get('from_url')
1219
+    ));
1220
+  }
1221
+  
1211 1222
 }

+ 3 - 0
src/Muzich/CoreBundle/Resources/config/routing.yml Voir le fichier

@@ -210,3 +210,6 @@ url_get_embed_for_element:
210 210
   pattern: /ajax/element/data/get/embed/{element_id}
211 211
   defaults: { _controller: MuzichCoreBundle:Element:getEmbedCode, element_id: null }
212 212
 
213
+share_from:
214
+  pattern: /element/share/from
215
+  defaults: { _controller: MuzichCoreBundle:Element:shareFrom }

+ 1 - 0
src/Muzich/CoreBundle/Resources/config/security.yml Voir le fichier

@@ -98,6 +98,7 @@ security:
98 98
         - { path: ^/(?:fr|en)/event/view/elements, role: IS_AUTHENTICATED_ANONYMOUSLY }
99 99
         - { path: ^/test-error, role: IS_AUTHENTICATED_ANONYMOUSLY }
100 100
         - { path: ^/share-from, role: IS_AUTHENTICATED_ANONYMOUSLY }
101
+        - { path: ^/(?:fr|en)/element/share/from, role: IS_AUTHENTICATED_ANONYMOUSLY }
101 102
         - { path: ^/(?:fr|en)/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
102 103
         - { path: ^/(?:fr|en)/account/email/confirm/, role: IS_AUTHENTICATED_ANONYMOUSLY }
103 104
         

+ 26 - 0
src/Muzich/CoreBundle/Resources/public/css/main.css Voir le fichier

@@ -2459,6 +2459,32 @@ div#tags_prompt_search p.help_notags span
2459 2459
   width: 480px;
2460 2460
 }
2461 2461
 
2462
+.iframe #main_content
2463
+{
2464
+  min-height: available;
2465
+  position: static;
2466
+  width: 600px;
2467
+}
2468
+
2469
+.iframe #content
2470
+{
2471
+  display: block;
2472
+  margin-left: auto;
2473
+  margin-right: auto;
2474
+  width: 100%;
2475
+}
2476
+
2477
+.iframe #main
2478
+{
2479
+  float: none;
2480
+  width: 100%;
2481
+}
2482
+
2483
+.iframe input#element_add_name, .iframe div#tags_prompt_add input.tag_prompt
2484
+{
2485
+  width: 440px;
2486
+}
2487
+
2462 2488
 /*
2463 2489
 *
2464 2490
 *

+ 23 - 0
src/Muzich/CoreBundle/Resources/views/Element/share_from.html.twig Voir le fichier

@@ -0,0 +1,23 @@
1
+{% extends "MuzichCoreBundle::layout_iframe.html.twig" %}
2
+
3
+{% block title %}{% endblock %}
4
+
5
+{% block main_content %}
6
+
7
+  {% include 'MuzichCoreBundle:Component:element_add_box.html.twig' with {
8
+    'box_title'     : 'home.add_element_box.title'|trans({}, 'navigationui'),
9
+    'add_form_name' : 'add',
10
+  } %}
11
+
12
+  <script type="text/javascript">
13
+    $(document).ready(function(){
14
+      $('#element_add_box').slideDown("slow");
15
+      $('#element_add_link').hide();
16
+      $('form[name="search"]').slideUp();
17
+      $('img#form_add_loader').show();
18
+      $('input#element_add_url').val("{{ from_url }}");
19
+      $('form[name="add"]').submit();
20
+    });
21
+  </script>
22
+
23
+{% endblock %}

+ 29 - 23
src/Muzich/CoreBundle/Resources/views/Layout/head_js.html.twig Voir le fichier

@@ -1,3 +1,7 @@
1
+{% if userecho is not defined %}
2
+  {% set userecho = true %}
3
+{% endif %}
4
+
1 5
 {% javascripts
2 6
   'js/jquery-1.8.2.prod.js'
3 7
   'js/jquery-ui-1.10.1.custom.min.js'
@@ -41,32 +45,34 @@
41 45
   });
42 46
 </script>
43 47
 
44
-<script type='text/javascript'>
48
+{% if userecho %}
49
+  <script type='text/javascript'>
45 50
 
46
-  var _ues = {
47
-  host:'muzich.userecho.com',
48
-  forum:'17651',
49
-  lang:'fr',
50
-  tab_corner_radius:5,
51
-  tab_font_size:20,
52
-  tab_image_hash:'Vm9zIHJldG91cnM%3D',
53
-  tab_chat_hash:'Y2hhdA%3D%3D',
54
-  tab_alignment:'right',
55
-  tab_text_color:'#000000',
56
-  tab_text_shadow_color:'#66666655',
57
-  tab_bg_color:'#F4F4F4',
58
-  tab_hover_color:'#D5D5D5'
59
-  };
51
+    var _ues = {
52
+    host:'muzich.userecho.com',
53
+    forum:'17651',
54
+    lang:'fr',
55
+    tab_corner_radius:5,
56
+    tab_font_size:20,
57
+    tab_image_hash:'Vm9zIHJldG91cnM%3D',
58
+    tab_chat_hash:'Y2hhdA%3D%3D',
59
+    tab_alignment:'right',
60
+    tab_text_color:'#000000',
61
+    tab_text_shadow_color:'#66666655',
62
+    tab_bg_color:'#F4F4F4',
63
+    tab_hover_color:'#D5D5D5'
64
+    };
60 65
 
61
-$(document).ready(function(){  
62
-(function() {
63
-    var _ue = document.createElement('script'); _ue.type = 'text/javascript'; _ue.async = true;
64
-    _ue.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.userecho.com/js/widget-1.4.gz.js';
65
-    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(_ue, s);
66
-  })();
67
-});
66
+  $(document).ready(function(){  
67
+  (function() {
68
+      var _ue = document.createElement('script'); _ue.type = 'text/javascript'; _ue.async = true;
69
+      _ue.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.userecho.com/js/widget-1.4.gz.js';
70
+      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(_ue, s);
71
+    })();
72
+  });
68 73
 
69
-</script>
74
+  </script>
75
+{% endif %}
70 76
 
71 77
 <script type="text/javascript">
72 78
   {% if app.user %}

+ 59 - 0
src/Muzich/CoreBundle/Resources/views/layout_iframe.html.twig Voir le fichier

@@ -0,0 +1,59 @@
1
+<!doctype html>
2
+<html xmlns:fb="http://www.facebook.com/2008/fbml">
3
+  <head>
4
+    <title>Muzi.ch - {% block title %}{% endblock %}</title>
5
+    {% include 'MuzichCoreBundle:Layout:head.html.twig' with {
6
+      'userecho' : false
7
+    } %}
8
+    {% block css %}{% endblock %}
9
+    {% block js %}{% endblock %}
10
+  </head>
11
+  <body>
12
+    
13
+    {% if  app.environment == 'prod' %}
14
+      {% include 'MuzichCoreBundle:Component:facebook.html.twig' %}
15
+    {% endif %}
16
+    {% include 'MuzichCoreBundle:Layout:noscript.html.twig' %}
17
+  
18
+  <div id="container" class="iframe">
19
+    
20
+    <div id="main_content">
21
+      
22
+      <div id="content">
23
+        
24
+        <div id="main" class="content">
25
+          
26
+          <div id="mainbox" class="nicebox {% block mainbox_classes %}{% endblock %}">
27
+            {% block main_content %}{% endblock %}
28
+            {% block fos_user_content %}{% endblock %}
29
+          </div>
30
+          
31
+        </div>
32
+          
33
+      </div>
34
+      
35
+    </div>
36
+    
37
+  </div>
38
+    
39
+    {% if  app.environment == 'prod' %} 
40
+      <!-- Piwik -->
41
+      <script type="text/javascript"> 
42
+        var _paq = _paq || [];
43
+        _paq.push(['trackPageView']);
44
+        _paq.push(['enableLinkTracking']);
45
+        (function() {
46
+          //var u=(("https:" == document.location.protocol) ? "https" : "http") + "://analytics.muzi.ch//"; # pas de certif sur analytics.muzi.ch pour le moment
47
+          var u=(("https:" == document.location.protocol) ? "http" : "http") + "://analytics.muzi.ch//";
48
+          _paq.push(['setTrackerUrl', u+'piwik.php']);
49
+          _paq.push(['setSiteId', 1]);
50
+          var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
51
+          g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
52
+        })();
53
+      
54
+      </script>
55
+      <noscript><p><img src="http://analytics.muzi.ch/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
56
+      <!-- End Piwik Code -->
57
+    {% endif %}
58
+  </body>
59
+</html>