GitHub PullRequestReviewCommentEvent at 2014-04-24 19:01:32
Repository: scielo-manager
Actor: jamilatta
Payload: {"comment":{"url":"https://api.github.com/repos/scieloorg/scielo-manager/pulls/comments/11965995","id":11965995,"diff_hunk":"@@ -128,4 +133,157 @@\n   <tbody>\n   </table>\n </form>\n+\n+<!-- Modal -->\n+  <div class=\"modal hide fade\" id=\"journal-check\">\n+\n+  <div class=\"modal-header\">\n+    <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n+    <h3 id=\"journal-check\">{% trans 'Check if journal already exists' %}</h3>\n+  </div>\n+\n+  <div class=\"modal-body\" style=\"height:250px;\">\n+\n+    <div id=\"check-message-info\" class=\"alert alert-warning\" style=\"display: none; position: fixed; top: 30%; left: 50%; margin-left: -210px; width: 400px; z-index: 9999; border: 1px solid;\">\n+      <a class=\"close\" data-dismiss=\"alert\" href=\"#\">x</a>\n+      <p><h4 class=\"alert-heading\"></i>{% trans 'Adding journal to my collection' %}</h4></p>\n+      <p id=\"alert-message-info\"></p>\n+      <p class=\"pull-right\">\n+        <a id=\"btn-alert-info\" class=\"btn\" href=\"#\">OK</a>\n+      </p>\n+    </div>\n+\n+    <div class=\"alert alert-info\">\n+      <i class=\"icon-info-sign\"></i> {% trans \"To insert a journal, you need to check whether the journal exists. If it exists just add to your collection!\" %} :-)\n+    </div>\n+\n+    <!-- Verification form -->\n+    <form>\n+\n+      <div class=\"control-group\" style=\"margin-bottom: 50px;\">\n+          <label>\n+              {% trans 'Search journal' %}:\n+          </label>\n+          <div class=\"controls\">\n+            <input type=\"hidden\" class=\"select2-chosen span12\" id=\"id-journal-check\" name=\"journal-input-check\">\n+          </div>\n+      </div>\n+\n+      <div class=\"control-group\" style=\"margin-bottom: 50px;\">\n+          <div class=\"controls\">\n+            <a id=\"btn-add-collection\" class=\"btn btn-success span12\" disabled href=\"#\">{% trans 'Add this journal to my current collection' %}</a>\n+          </div>\n+      </div>\n+\n+    </form>\n+    <!-- Verification form -->\n+\n+  </div>\n+\n+  <div class=\"modal-footer\">\n+    <!-- add {% url journal.add %} to the href if user dont find the journal -->\n+    <a id=\"btn-add-new-journal\" class=\"btn btn-danger span12\" href=\"{% url journal.add %}\">{% trans 'I understand the consequences, add new journal' %}</a>\n+  </div>\n+\n+ </div>\n+<!-- Modal -->\n+\n+{% endblock %}\n+\n+{% block extrafooter %}\n+  <script type=\"text/javascript\" src=\"{% get_static_prefix %}js/jquery/select2.js\"></script>\n+\n+  <script>\n+\n+     $('#new-journal').click(function(){\n+        $('#journal-check').modal();\n+     });\n+\n+     $('#journal-check').on('hidden', function(){\n+        window.location.reload(true);\n+     });\n+\n+     $('#btn-alert-info').click(function(){\n+        $(\"#check-message-info\").css('display', 'none');\n+     });\n+\n+    function result(data){\n+        return \"<b>\" + data.title + \"</b> - \" + data.short_title\n+               + \"</br><b>{% trans 'Print ISSN' %}: </b>\" + data.print_issn\n+               + \"</br><b>{% trans 'Eletronic ISSN' %}: </b>\" + data.eletronic_issn\n+               + \"</br><b>{% trans 'Acronym' %}: </b>\" + data.acronym\n+               + \"</br><b>{% trans 'Coleções' %}: </b>\" + data.collections\n+      }\n+\n+    function selection(data){\n+        return '<b>' + data.title + '</b> - '\n+               + data.short_title + ' '\n+               + data.print_issn + ' '\n+               + data.eletronic_issn + ' '\n+               + data.acronym\n+    }\n+\n+    function nomatches(term){\n+        return \"{% trans 'No journal(s) found to the term: ' %}\" + term\n+    }\n+\n+    $(\"#id-journal-check\").on('select2-selecting', function(e){\n+                              $(\"#btn-add-collection\").attr(\"disabled\", false);\n+                              $(\"#btn-add-new-journal\").attr(\"disabled\", true);\n+                            });\n+\n+    $(\"#id-journal-check\").on('select2-removed', function(e){\n+                              $(\"#btn-add-collection\").attr(\"disabled\", true);\n+                              $(\"#btn-add-new-journal\").attr(\"disabled\", false);\n+                            });\n+\n+    $(\"#id-journal-check\").select2({\n+        placeholder: '{% trans \"Search by: title, abbreviated title, acronym and ISSN(s)\" %}',\n+        minimumInputLength: 3,\n+        allowClear: true,\n+        ajax: {\n+            url: \"{% url ajx.ajx_search_journal %}\",\n+            dataType: 'json',\n+            data: function (term, page) {\n+                return {\n+                    q: term,\n+                    page_limit: 10,\n+                };\n+            },\n+            results: function (data, page) {\n+                return {results: data.data};\n+            }\n+        },\n+        formatResult: result,\n+        formatSelection: selection,\n+        formatNoMatches: nomatches,\n+        dropdownCssClass: \"bigdrop\",\n+        sescapeMarkup: function (m) { return m; }\n+    });\n+\n+    $(\"#btn-add-collection\").click(function(){\n+      $.ajax({\n+        url: \"ajx/ajx4/\" + $(\"#id-journal-check\")[0].value,\n+        dataType: 'json',\n+        type: \"GET\",\n+        success: function(data){\n+            if (!data.assignment){\n+              $('#alert-message-info').html(\"<b>\" + data.journal\n+                                            + \"</b> {% trans 'is already member of collection' %}: \"\n+                                            + \"<b>\" + data.collection + \"</b>\")\n+              $('#check-message-info').toggle()\n+            }else{\n+              $('#journal-check').modal('hide');\n+            }\n+\n+          },\n+        fail: function(){\n+            alert('{% trans \"An unexpected error. Please try again later.\" %}')","path":"scielomanager/journalmanager/templates/journalmanager/journal_list.html","position":194,"original_position":194,"commit_id":"5641b9e43b098e73699fe91f88e268a7c85cd7c7","original_commit_id":"5641b9e43b098e73699fe91f88e268a7c85cd7c7","user":{"login":"jamilatta","id":373745,"avatar_url":"https://avatars.githubusercontent.com/u/373745?","gravatar_id":"74ccef328abd9bcfd9035aa179510a24","url":"https://api.github.com/users/jamilatta","html_url":"https://github.com/jamilatta","followers_url":"https://api.github.com/users/jamilatta/followers","following_url":"https://api.github.com/users/jamilatta/following{/other_user}","gists_url":"https://api.github.com/users/jamilatta/gists{/gist_id}","starred_url":"https://api.github.com/users/jamilatta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamilatta/subscriptions","organizations_url":"https://api.github.com/users/jamilatta/orgs","repos_url":"https://api.github.com/users/jamilatta/repos","events_url":"https://api.github.com/users/jamilatta/events{/privacy}","received_events_url":"https://api.github.com/users/jamilatta/received_events","type":"User","site_admin":false},"body":"Falta habilidades em css. :-(\r\n\r\n\r\n2014-04-24 16:01 GMT-03:00 Jamil Atta Junior Atta <atta.jamil@gmail.com>:\r\n\r\n> Tentei fazer assim mas é um pouco complicado quando estamos em um modal,\r\n> não consegui colocar a caixa de msg no top.\r\n>\r\n>\r\n> On Thu, Apr 24, 2014 at 3:58 PM, Juan Funez <notifications@github.com>wrote:\r\n>\r\n>> In\r\n>> scielomanager/journalmanager/templates/journalmanager/journal_list.html:\r\n>>\r\n>> > +        url: \"ajx/ajx4/\" + $(\"#id-journal-check\")[0].\r\n>> value,\r\n>> > +        dataType: 'json',\r\n>> > +        type: \"GET\",\r\n>> > +        success: function(data){\r\n>> > +            if (!data.assignment){\r\n>> > +              $('#alert-message-info').html(\"<b>\" + data.journal\r\n>> > +                                            + \"</b> {% trans 'is already member of collection' %}: \"\r\n>> > +                                            + \"<b>\" + data.collection + \"</b>\")\r\n>> > +              $('#check-message-info').toggle()\r\n>> > +            }else{\r\n>> > +              $('#journal-check').modal('hide');\r\n>> > +            }\r\n>> > +\r\n>> > +          },\r\n>> > +        fail: function(){\r\n>> > +            alert('{% trans \"An unexpected error. Please try again later.\" %}')\r\n>>\r\n>> acho que ficaria melhor mostrar a msg de erro dentro do modal, com um\r\n>> alert box como são exibidos os erros nos formulários.\r\n>>\r\n>> —\r\n>> Reply to this email directly or view it on GitHub<https://github.com/scieloorg/scielo-manager/pull/753/files#r11965766>\r\n>> .\r\n>>\r\n>\r\n>\r\n>\r\n> --\r\n> Atenciosamente,\r\n>\r\n> Jamil Atta Junior\r\n>\r\n>\r\n\r\n\r\n-- \r\nAtenciosamente,\r\n\r\nJamil Atta Junior","created_at":"2014-04-24T19:01:32Z","updated_at":"2014-04-24T19:01:32Z","html_url":"https://github.com/scieloorg/scielo-manager/pull/753#discussion_r11965995","pull_request_url":"https://api.github.com/repos/scieloorg/scielo-manager/pulls/753","_links":{"self":{"href":"https://api.github.com/repos/scieloorg/scielo-manager/pulls/comments/11965995"},"html":{"href":"https://github.com/scieloorg/scielo-manager/pull/753#discussion_r11965995"},"pull_request":{"href":"https://api.github.com/repos/scieloorg/scielo-manager/pulls/753"}}}}