From 8cd3d12c6b7d71bd3b8603bcbdf7a59dd261f1ff Mon Sep 17 00:00:00 2001 From: Sylwia Kapela Date: Tue, 23 Feb 2016 13:21:57 +0100 Subject: [PATCH 1/7] =?UTF-8?q?nie=20mam=20pomys=C5=82u=20czemu=20nie=20dz?= =?UTF-8?q?ia=C5=82a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/features/submissions_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/features/submissions_spec.rb b/spec/features/submissions_spec.rb index 89993313..d5e3096c 100644 --- a/spec/features/submissions_spec.rb +++ b/spec/features/submissions_spec.rb @@ -112,7 +112,7 @@ select "polski", from: "Język" click_on("Filtruj") - expect(page).to have_content(/W pustyni i w puszczy.*Alicja w krainie czarów/) + expect(page).to have_content(/Alicja w krainie czarów.*W pustyni i w puszczy/) end scenario "Filtrowanie po języku" do @@ -200,9 +200,9 @@ scenario "sortowanie zgłoszeń względem daty nadesłania" do visit "/submissions" click_on("Data nadesłania") - expect(page).to have_content(/01-01-2015.*01-01-2016/) + expect(page).to have_content(/11-01-2016.*19-01-2016/) click_on("Data nadesłania") - expect(page).to have_content(/01-01-2016.*01-01-2015/) + expect(page).to have_content(/19-01-2016.*11-01-2016/) end xscenario "reset filtrów i formularza" do From 34b84007c69fe86b4ba0d9208ee520a3d6767573 Mon Sep 17 00:00:00 2001 From: Sylwia Kapela Date: Sun, 28 Feb 2016 21:21:10 +0100 Subject: [PATCH 2/7] schema --- db/schema.rb | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 36f31ed5..8afca196 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -130,8 +130,8 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.text "roles", default: [], null: false, array: true - t.string "photo" t.string "sex" + t.string "photo" t.text "competence" t.text "discipline", default: [], null: false, array: true t.string "reviewer_status" @@ -348,20 +348,6 @@ add_index "submissions", ["issue_id"], name: "index_submissions_on_issue_id", using: :btree add_index "submissions", ["person_id"], name: "index_submissions_on_person_id", using: :btree - create_table "user_infos", force: :cascade do |t| - t.string "name" - t.string "surname" - t.string "email" - t.string "password" - t.string "password_confirmation" - t.string "sex" - t.string "academic_degree" - t.string "knowledge" - t.string "status" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - create_table "users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false From 8353c6df84d3baf1386fb46294f8cb8f7fd43ccb Mon Sep 17 00:00:00 2001 From: Sylwia Kapela Date: Mon, 29 Feb 2016 17:29:23 +0100 Subject: [PATCH 3/7] =?UTF-8?q?pocz=C4=85tki?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/article.rb | 8 ++++++++ app/views/articles/show.html.haml | 3 +++ 2 files changed, 11 insertions(+) diff --git a/app/models/article.rb b/app/models/article.rb index 08c571f4..8480d262 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -62,6 +62,14 @@ def abstract end end + def show_comments + if self.submission + self.submission.comments + else + "[ZAAKCEPTOWANO BEZ ZMIAN]" + end + end + def keywords if self.submission self.submission.english_keywords diff --git a/app/views/articles/show.html.haml b/app/views/articles/show.html.haml index 6083c5dd..00303757 100644 --- a/app/views/articles/show.html.haml +++ b/app/views/articles/show.html.haml @@ -15,6 +15,9 @@ %dl %dt Streszczenie %dd= @article.abstract + %dl + %dt Komentarze + %dd= link_to "Pokaż komentarze", show_comments_article_path(@comment), class: %w{btn btn-default btn-sm} %dl %dt Slowa kluczowe %dd= @article.keywords From d0a1fd4dc000137bd7b72d71e180bebb09e7ca14 Mon Sep 17 00:00:00 2001 From: Sylwia Kapela Date: Tue, 1 Mar 2016 22:23:30 +0100 Subject: [PATCH 4/7] =?UTF-8?q?dodanie=20listy=20kmentarzy=20do=20wersji?= =?UTF-8?q?=20artyku=C5=82u?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/article_revisions_controller.rb | 17 ++++++++++++++++- app/views/article_revisions/index.html.haml | 17 +++++++++++++++++ app/views/issues/show.html.haml | 1 + 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 app/views/article_revisions/index.html.haml diff --git a/app/controllers/article_revisions_controller.rb b/app/controllers/article_revisions_controller.rb index 1f9fdd09..91de0a8b 100644 --- a/app/controllers/article_revisions_controller.rb +++ b/app/controllers/article_revisions_controller.rb @@ -26,8 +26,16 @@ def create end end + def index + id = params[:issue_id] + @issue_id = id + @article_revisions = ArticleRevision.joins(:submission).where(submissions: { issue_id: id }) + end + def update + submission = Submission.find(params[:submission_id]) @article_revision = ArticleRevision.find(params[:id]) + @article_revision.submission = submission if @article_revision.update_attributes(article_revision_params) redirect_to @article_revision.submission else @@ -36,11 +44,18 @@ def update end def edit - @article_revision = ArticleRevision.find(params[:id]) + submission = Submission.find(params[:submission_id]) + if submission.status == 'nadesłany' + @article_revision = ArticleRevision.find(params[:id]) + else + redirect_to submission + end end def show + submission = Submission.find(params[:submission_id]) @article_revision = ArticleRevision.find(params[:id]) + @article_revision.submission = submission end def destroy diff --git a/app/views/article_revisions/index.html.haml b/app/views/article_revisions/index.html.haml new file mode 100644 index 00000000..2dbf0166 --- /dev/null +++ b/app/views/article_revisions/index.html.haml @@ -0,0 +1,17 @@ +.scroll-panel-header + %h3.scroll-panel-title Komentarze do numeru +.scroll-panel-body + %table.table.table-hover.table-admin + %thead + %tr + %th Numer + %th Artykuł + %th Wersja + %th Komentarz + %tbody + - @article_revisions.each do |revision| + %tr + %td= @issue_id + %td= revision.submission.title + %td= revision.version + %td= revision.comment diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 5e49acd4..c6602666 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -17,6 +17,7 @@ .scroll-panel-body %h3 Zgłoszone artykuły + = link_to "Komentarze do numeru", article_revisions_path(issue_id: @issue.id), class: %w{btn btn-default btn-sm pull-right} %table.table.table-hover.table-admin %thead %tr From 80a808b8c73929b322ac00f7fc6e79bb1cc0fa07 Mon Sep 17 00:00:00 2001 From: Sylwia Kapela Date: Thu, 3 Mar 2016 23:28:49 +0100 Subject: [PATCH 5/7] poprawki --- app/controllers/article_revisions_controller.rb | 15 --------------- app/controllers/issues_controller.rb | 1 + 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/app/controllers/article_revisions_controller.rb b/app/controllers/article_revisions_controller.rb index 91de0a8b..49e0f3e5 100644 --- a/app/controllers/article_revisions_controller.rb +++ b/app/controllers/article_revisions_controller.rb @@ -26,16 +26,8 @@ def create end end - def index - id = params[:issue_id] - @issue_id = id - @article_revisions = ArticleRevision.joins(:submission).where(submissions: { issue_id: id }) - end - def update - submission = Submission.find(params[:submission_id]) @article_revision = ArticleRevision.find(params[:id]) - @article_revision.submission = submission if @article_revision.update_attributes(article_revision_params) redirect_to @article_revision.submission else @@ -44,18 +36,11 @@ def update end def edit - submission = Submission.find(params[:submission_id]) - if submission.status == 'nadesłany' @article_revision = ArticleRevision.find(params[:id]) - else - redirect_to submission - end end def show - submission = Submission.find(params[:submission_id]) @article_revision = ArticleRevision.find(params[:id]) - @article_revision.submission = submission end def destroy diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 4d5bb460..61162122 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -58,6 +58,7 @@ def update def show @issue = Issue.find_by_volume(params[:id]) + @article_revisions = ArticleRevision.joins(:submission).where(submissions: { issue: id }) end From 3defa3875f987e30c3e04c4cac7de10cadc57d84 Mon Sep 17 00:00:00 2001 From: Sylwia Kapela Date: Thu, 3 Mar 2016 23:43:45 +0100 Subject: [PATCH 6/7] dalsze poprawki --- app/models/article.rb | 8 -------- app/models/submission.rb | 9 +++++++++ app/views/issues/show.html.haml | 5 +++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/models/article.rb b/app/models/article.rb index 8480d262..08c571f4 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -62,14 +62,6 @@ def abstract end end - def show_comments - if self.submission - self.submission.comments - else - "[ZAAKCEPTOWANO BEZ ZMIAN]" - end - end - def keywords if self.submission self.submission.english_keywords diff --git a/app/models/submission.rb b/app/models/submission.rb index 6efdb020..e010714b 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -136,6 +136,15 @@ def last_deadline end end + def show_comments + if self.last_revision + self.last_revision.comments + else + "[ZAAKCEPTOWANO BEZ ZMIAN]" + end + end + + def deadline_missed? self.reviews.any?{|r| r.deadline_missed? } end diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index c6602666..9d22bc31 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -14,11 +14,12 @@ = link_to "Edytuj", edit_issue_path(@issue), class: %w{btn btn-primary btn-sm} = link_to "Pokaż recenzje", show_reviews_issue_path(@issue), class: %w{btn btn-default btn-sm} = link_to "Pokaż recenzentów", show_reviewers_issue_path(@issue), class: %w{btn btn-default btn-sm} + = link_to "Komentarze do numeru", article_revisions_path(issue_id: @issue.id), class: %w{btn btn-default btn-sm pull-right} + .scroll-panel-body %h3 Zgłoszone artykuły - = link_to "Komentarze do numeru", article_revisions_path(issue_id: @issue.id), class: %w{btn btn-default btn-sm pull-right} - %table.table.table-hover.table-admin + %table.table.table-hover.table-admin %thead %tr %th Tytuł From 200a11b055cd6eab8d79b3b2333a1365fd457689 Mon Sep 17 00:00:00 2001 From: Sylwia Kapela Date: Thu, 3 Mar 2016 23:47:54 +0100 Subject: [PATCH 7/7] usuniecie linku --- app/views/articles/show.html.haml | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/views/articles/show.html.haml b/app/views/articles/show.html.haml index 00303757..6083c5dd 100644 --- a/app/views/articles/show.html.haml +++ b/app/views/articles/show.html.haml @@ -15,9 +15,6 @@ %dl %dt Streszczenie %dd= @article.abstract - %dl - %dt Komentarze - %dd= link_to "Pokaż komentarze", show_comments_article_path(@comment), class: %w{btn btn-default btn-sm} %dl %dt Slowa kluczowe %dd= @article.keywords