From f6a7605476df132998d3c5413670cb86bdf24635 Mon Sep 17 00:00:00 2001 From: Alexander Tsybulsky Date: Thu, 20 Apr 2017 22:32:35 +0300 Subject: [PATCH] #714 news improvements (done) --- src/zabapgit_css_common.w3mi.data.css | 20 ++++++------ src/zabapgit_html_chunks.prog.abap | 7 ++--- src/zabapgit_news.prog.abap | 45 +++++++++++++++++---------- 3 files changed, 42 insertions(+), 30 deletions(-) diff --git a/src/zabapgit_css_common.w3mi.data.css b/src/zabapgit_css_common.w3mi.data.css index ebf3ad6cb..09d540e60 100644 --- a/src/zabapgit_css_common.w3mi.data.css +++ b/src/zabapgit_css_common.w3mi.data.css @@ -782,7 +782,7 @@ div.news div.title a.close-btn { div.news div.important { color: #aaa; } div.news div.newslist { - padding: 0.5em; + padding: 0.5em 0.7em; color: #444; } @@ -801,16 +801,16 @@ div.news h1 { } div.news .version-marker { - color: #888; + color: white; display: inline-block; - margin-left: 16px; -} - -div.news .version-marker > .version-tag { - background-color: #ccc; - border: #c0c0c0 1px solid; + margin-left: 20px; border-radius: 3px; padding: 0px 6px; - color: white; - margin-left: 8px; + border: #c0c0c0 1px solid; + background-color: #ccc; +} + +div.news .update { + border: #e8ba30 1px solid; + background-color: #f5c538; } diff --git a/src/zabapgit_html_chunks.prog.abap b/src/zabapgit_html_chunks.prog.abap index 621139fb1..01ec7bb1b 100644 --- a/src/zabapgit_html_chunks.prog.abap +++ b/src/zabapgit_html_chunks.prog.abap @@ -286,11 +286,10 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION. LOOP AT lt_log ASSIGNING . IF -is_header = abap_true. IF -pos_to_cur > 0. - lv_text = -text && ''. + lv_text = -text && 'update'. ELSEIF -pos_to_cur = 0. - lv_text = -text && '⇦' - && 'current'. - ELSE. + lv_text = -text && 'current'. + ELSE. " < 0 lv_text = -text. ENDIF. ro_html->add( |

{ lv_text }

| ). diff --git a/src/zabapgit_news.prog.abap b/src/zabapgit_news.prog.abap index 359d3ca68..f5d5965d0 100644 --- a/src/zabapgit_news.prog.abap +++ b/src/zabapgit_news.prog.abap @@ -92,29 +92,42 @@ CLASS lcl_news IMPLEMENTATION. lc_log_filename TYPE string VALUE 'changelog.txt'. DATA: lt_remote TYPE ty_files_tt, + lv_last_seen TYPE string, + lv_url TYPE string, lo_repo_online TYPE REF TO lcl_repo_online. FIELD-SYMBOLS LIKE LINE OF lt_remote. - IF io_repo->is_offline( ) = abap_false. - lo_repo_online ?= io_repo. + IF io_repo->is_offline( ) = abap_true. + RETURN. + ENDIF. - " News announcement temporary restricted to abapGit only - IF lo_repo_online->get_url( ) NS '/abapGit.git'. " TODO refactor - RETURN. - ENDIF. + lo_repo_online ?= io_repo. + lv_url = lo_repo_online->get_url( ). - lt_remote = io_repo->get_files_remote( ). + " News announcement temporary restricted to abapGit only + IF lv_url NS '/abapGit.git'. " TODO refactor + RETURN. + ENDIF. - READ TABLE lt_remote ASSIGNING - WITH KEY path = lc_log_path filename = lc_log_filename. + lv_last_seen = lcl_app=>user( )->get_repo_last_change_seen( lv_url ). - IF sy-subrc = 0. - CREATE OBJECT ro_instance EXPORTING - iv_rawdata = -data - iv_current_version = gc_abap_version - iv_lastseen_version = gc_abap_version. " TODO refactor - ENDIF. + " Find changelog + lt_remote = io_repo->get_files_remote( ). + READ TABLE lt_remote ASSIGNING + WITH KEY path = lc_log_path filename = lc_log_filename. + + IF sy-subrc = 0. + CREATE OBJECT ro_instance EXPORTING + iv_rawdata = -data + iv_current_version = gc_abap_version " TODO refactor + iv_lastseen_version = normalize_version( lv_last_seen ). + ENDIF. + + IF ro_instance IS BOUND. + lcl_app=>user( )->set_repo_last_change_seen( + iv_url = lv_url + iv_version = ro_instance->latest_version( ) ). ENDIF. ENDMETHOD. "create @@ -128,7 +141,7 @@ CLASS lcl_news IMPLEMENTATION. " Validate params mv_current_version = normalize_version( iv_current_version ). mv_lastseen_version = normalize_version( iv_lastseen_version ). - IF mv_current_version IS INITIAL OR mv_lastseen_version IS INITIAL. + IF mv_current_version IS INITIAL. RETURN. " Internal format of program version is not correct -> abort parsing ENDIF.