#714 news improvements (done)

This commit is contained in:
Alexander Tsybulsky 2017-04-20 22:32:35 +03:00
parent 7f1a77bae4
commit f6a7605476
3 changed files with 42 additions and 30 deletions

View File

@ -782,7 +782,7 @@ div.news div.title a.close-btn {
div.news div.important { color: #aaa; } div.news div.important { color: #aaa; }
div.news div.newslist { div.news div.newslist {
padding: 0.5em; padding: 0.5em 0.7em;
color: #444; color: #444;
} }
@ -801,16 +801,16 @@ div.news h1 {
} }
div.news .version-marker { div.news .version-marker {
color: #888; color: white;
display: inline-block; display: inline-block;
margin-left: 16px; margin-left: 20px;
}
div.news .version-marker > .version-tag {
background-color: #ccc;
border: #c0c0c0 1px solid;
border-radius: 3px; border-radius: 3px;
padding: 0px 6px; padding: 0px 6px;
color: white; border: #c0c0c0 1px solid;
margin-left: 8px; background-color: #ccc;
}
div.news .update {
border: #e8ba30 1px solid;
background-color: #f5c538;
} }

View File

@ -286,11 +286,10 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION.
LOOP AT lt_log ASSIGNING <line>. LOOP AT lt_log ASSIGNING <line>.
IF <line>-is_header = abap_true. IF <line>-is_header = abap_true.
IF <line>-pos_to_cur > 0. IF <line>-pos_to_cur > 0.
lv_text = <line>-text && '<span class="version-marker warning">&#x25cf;</span>'. lv_text = <line>-text && '<span class="version-marker update">update</span>'.
ELSEIF <line>-pos_to_cur = 0. ELSEIF <line>-pos_to_cur = 0.
lv_text = <line>-text && '<span class="version-marker">&#x21e6;' lv_text = <line>-text && '<span class="version-marker">current</span>'.
&& '<span class="version-tag">current</span></span>'. ELSE. " < 0
ELSE.
lv_text = <line>-text. lv_text = <line>-text.
ENDIF. ENDIF.
ro_html->add( |<h1>{ lv_text }</h1>| ). ro_html->add( |<h1>{ lv_text }</h1>| ).

View File

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