news finetuning

This commit is contained in:
Alexander Tsybulsky 2017-04-13 09:56:27 +03:00
parent 30f89dc9b5
commit 782aa27d98
3 changed files with 67 additions and 66 deletions

View File

@ -62,6 +62,8 @@ input:focus, textarea:focus {
.pad4px { padding: 4px; }
.w100 { width: 100%; }
.w40 { width: 40%; }
.float-right { float: right; }
.pad-right { padding-right: 6px; }
/* STRUCTURE DIVS, HEADER & FOOTER */
div#header {
@ -126,6 +128,7 @@ div.repo {
margin-top: 3px;
background-color: #f2f2f2;
padding: 0.5em 1em 0.5em 1em;
position: relative;
}
.repo_name span.name {
font-weight: bold;
@ -744,47 +747,47 @@ div.tutorial h2 {
.nav-container ul ul li.separator:hover { background-color: inherit; }
/* News Announcement */
.news {
div.news {
position: absolute;
z-index: 99;
top: 50%;
top: 36px;
left: 50%;
width: 40em;
margin-top: -12em;
margin-left: -20em;
border: 1px solid #ccc;
background-color: white;
box-shadow: 1px 1px 3px 2px #dcdcdc;
}
div.news div.headbar {
text-transform: uppercase;
font-size: small;
padding: 4px 6px;
}
div.news div.title {
color: #f8f8f8;
background-color: #888;
}
div.news div.title a { color: #c6d6ec; }
div.news div.important { color: #e8961b; }
div.news div.newslist {
padding: 0.5em;
color: #444;
}
.news .title {
color: #888888;
font-weight: bold;
font-size: 16px;
padding-top: 4px;
padding-bottom: 4px;
}
.news .attention {
background-color: #ff9800;
color: white;
padding: 10px;
}
.news li {
margin: 4px;
div.news li {
padding-left: 10px;
font-size: 15px;
list-style-type: none;
}
.news p.versionHeader {
font-size: 16px;
color: #888888;
font-weight: bold;
text-align: left;
padding-top: 8px;
padding-bottom: 8px;
border-bottom: 1px #ddd solid;
margin: 4px;
div.news h1:first-child { margin: auto; }
div.news h1 {
font-size: inherit;
padding: 6px 4px;
margin: 4px auto auto;
text-decoration: underline;
font-weight: normal;
}

View File

@ -80,9 +80,10 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION.
ro_html->add( '<td class="repo_attr right">' ).
IF io_news IS BOUND AND io_news->has_news( ) = abap_true.
ro_html->add_a( iv_act = 'displayNews()'
iv_typ = gc_action_type-onclick
iv_txt = lcl_html=>icon( iv_name = 'history/dark' ) ).
ro_html->add_a( iv_act = 'displayNews()'
iv_typ = gc_action_type-onclick
iv_txt = lcl_html=>icon( iv_name = 'pulse/blue'
iv_hint = 'Display changelog' ) ).
ENDIF.
IF abap_true = lcl_app=>user( )->is_favorite_repo( io_repo->get_key( ) ).
@ -231,44 +232,39 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION.
METHOD render_news.
DATA lt_log TYPE lcl_news=>tt_log.
FIELD-SYMBOLS: <line> LIKE LINE OF lt_log.
CREATE OBJECT ro_html.
IF io_news IS NOT BOUND.
RETURN.
ELSEIF io_news->has_news( ) = abap_true.
lt_log = io_news->get_log( ).
ELSE.
IF io_news IS NOT BOUND OR io_news->has_news( ) = abap_false.
RETURN.
ENDIF.
FIELD-SYMBOLS: <line> LIKE LINE OF lt_log.
lt_log = io_news->get_log( ).
ro_html->add( '<div id="news" class="news">' ).
ro_html->add( '<div id="news" class="news" style="display:none">' ).
ro_html->add( '<table class="w100"><tr>' ).
ro_html->add( '<td class="title">' ).
ro_html->add( 'Announcement of the latest changes' ).
ro_html->add( '</td>' ).
ro_html->add( '<td class="right">' ).
ro_html->add( '<a onclick="displayNews()">close</a>' ).
ro_html->add( '</td>' ).
ro_html->add( '</tr></table>' ).
ro_html->add( '<div class="headbar title">Announcement of the latest changes'
&& '<div class="float-right"><a onclick="displayNews()">close</a></div>'
&& '</div>' ).
IF io_news->has_important_news( ) = abap_true.
ro_html->add( '<div class="attention">'
&& 'Some changes mentioned in this announcement might be critical !'
ro_html->add( '<div class="headbar important">'
&& lcl_html=>icon( iv_name = 'alert' iv_class = 'pad-right' )
&& 'Please note changes marked with <b>"!"</b>'
&& '</div>' ).
ENDIF.
" Generate news
ro_html->add( |<div class="newslist">| ).
LOOP AT lt_log ASSIGNING <line>.
IF <line>-header = 'X'.
ro_html->add( |<p class="versionHeader"> { <line>-text } </p>| ).
ro_html->add( |<h1>{ <line>-text }</h1>| ).
ELSE.
ro_html->add( |<li> { <line>-text } </li>| ).
ro_html->add( |<li>{ <line>-text }</li>| ).
ENDIF.
ENDLOOP.
ro_html->add( '</div>' ).
ro_html->add( '</div>' ).

View File

@ -21,12 +21,13 @@ CLASS lcl_news DEFINITION FRIENDS ltcl_news.
tt_log TYPE STANDARD TABLE OF ty_log WITH DEFAULT KEY.
CONSTANTS:
c_log_filename TYPE string VALUE '/',
c_log_path TYPE string VALUE 'changelog.txt'.
c_log_path TYPE string VALUE '/',
c_log_filename TYPE string VALUE 'changelog.txt'.
CLASS-METHODS create
IMPORTING io_repo TYPE REF TO lcl_repo
RETURNING VALUE(ro_instance) TYPE REF TO lcl_news.
RETURNING VALUE(ro_instance) TYPE REF TO lcl_news
RAISING lcx_exception.
METHODS:
constructor
@ -71,8 +72,8 @@ ENDCLASS. "lcl_news
CLASS lcl_news IMPLEMENTATION.
METHOD constructor.
DATA:
lt_lines TYPE string_table,
DATA: lt_lines TYPE string_table,
lv_string TYPE string.
lv_string = lcl_convert=>xstring_to_string_utf8( iv_rawdata ).
@ -83,8 +84,7 @@ CLASS lcl_news IMPLEMENTATION.
METHOD create.
DATA:
lt_remote TYPE ty_files_tt,
DATA: lt_remote TYPE ty_files_tt,
lo_repo_online TYPE REF TO lcl_repo_online.
FIELD-SYMBOLS <file> LIKE LINE OF lt_remote.
@ -96,12 +96,14 @@ CLASS lcl_news IMPLEMENTATION.
IF lo_repo_online->get_url( ) CS '/abapGit.git'.
lt_remote = io_repo->get_files_remote( ).
READ TABLE lt_remote ASSIGNING <file> WITH KEY path = c_log_filename
filename = c_log_path.
READ TABLE lt_remote ASSIGNING <file>
WITH KEY path = c_log_path filename = c_log_filename.
IF sy-subrc = 0.
CREATE OBJECT ro_instance EXPORTING
iv_rawdata = <file>-data
iv_version = gc_abap_version.
CREATE OBJECT ro_instance EXPORTING
iv_rawdata = <file>-data
iv_version = gc_abap_version.
* iv_version = 'v1.30.0'. " for debug
ENDIF.
ENDIF.
ENDIF.
@ -360,13 +362,13 @@ CLASS ltcl_news IMPLEMENTATION.
" Generate test data
APPEND '======' TO lt_lines.
APPEND '------' TO lt_lines.
APPEND ' ' TO lt_lines.
APPEND ` ` TO lt_lines.
APPEND 'abapGit changelog' TO lt_lines.
APPEND '2017-02-13 v1.28.0' TO lt_lines.
APPEND '------------------' TO lt_lines.
APPEND '+ Staging page redesigned' TO lt_lines.
APPEND '! Support for core data services' TO lt_lines.
APPEND ' ' TO lt_lines.
APPEND ` ` TO lt_lines.
APPEND '2017-01-25 v1.27.0' TO lt_lines.
APPEND '------------------' TO lt_lines.
APPEND '+ Two factor authentication with github.com' TO lt_lines.