html refactoring (#3843)

* html refactoring

change A() to instance method
remove ADD_CHECKBOX alias

* removes ICON alias

* more
This commit is contained in:
Lars Hvam 2020-09-06 09:45:51 +02:00 committed by GitHub
parent 24cba9e221
commit 6739b768e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 264 additions and 221 deletions

View File

@ -8,14 +8,18 @@ CLASS zcl_abapgit_html DEFINITION
ALIASES add ALIASES add
FOR zif_abapgit_html~add . FOR zif_abapgit_html~add .
ALIASES add_checkbox
FOR zif_abapgit_html~add_checkbox .
ALIASES icon
FOR zif_abapgit_html~icon .
CONSTANTS c_indent_size TYPE i VALUE 2 ##NO_TEXT. CONSTANTS c_indent_size TYPE i VALUE 2 ##NO_TEXT.
CLASS-METHODS class_constructor . CLASS-METHODS class_constructor .
CLASS-METHODS icon
IMPORTING
!iv_name TYPE string
!iv_hint TYPE string OPTIONAL
!iv_class TYPE string OPTIONAL
!iv_onclick TYPE string OPTIONAL
RETURNING
VALUE(rv_str) TYPE string .
PROTECTED SECTION. PROTECTED SECTION.
PRIVATE SECTION. PRIVATE SECTION.
@ -117,6 +121,43 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
ENDMETHOD. ENDMETHOD.
METHOD icon.
DATA: lv_hint TYPE string,
lv_name TYPE string,
lv_color TYPE string,
lv_class TYPE string,
lv_large_icon TYPE string,
lv_xpixel TYPE i,
lv_onclick TYPE string.
SPLIT iv_name AT '/' INTO lv_name lv_color.
IF iv_hint IS NOT INITIAL.
lv_hint = | title="{ iv_hint }"|.
ENDIF.
IF iv_onclick IS NOT INITIAL.
lv_onclick = | onclick="{ iv_onclick }"|.
ENDIF.
IF iv_class IS NOT INITIAL.
lv_class = | { iv_class }|.
ENDIF.
IF lv_color IS NOT INITIAL.
lv_color = | { lv_color }|.
ENDIF.
lv_xpixel = cl_gui_cfw=>compute_pixel_from_metric( x_or_y = 'X'
in = 1 ).
IF lv_xpixel >= 2.
lv_large_icon = ' large'.
ENDIF.
rv_str = |<i class="icon{ lv_large_icon } icon-{ lv_name }{ lv_color }|.
rv_str = |{ rv_str }{ lv_class }"{ lv_onclick }{ lv_hint }></i>|.
ENDMETHOD.
METHOD indent_line. METHOD indent_line.
DATA: ls_study TYPE ty_study_result, DATA: ls_study TYPE ty_study_result,
@ -321,37 +362,11 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
METHOD zif_abapgit_html~icon. METHOD zif_abapgit_html~icon.
DATA: lv_hint TYPE string, rv_str = icon(
lv_name TYPE string, iv_name = iv_name
lv_color TYPE string, iv_hint = iv_hint
lv_class TYPE string, iv_class = iv_class
lv_large_icon TYPE string, iv_onclick = iv_onclick ).
lv_xpixel TYPE i,
lv_onclick TYPE string.
SPLIT iv_name AT '/' INTO lv_name lv_color.
IF iv_hint IS NOT INITIAL.
lv_hint = | title="{ iv_hint }"|.
ENDIF.
IF iv_onclick IS NOT INITIAL.
lv_onclick = | onclick="{ iv_onclick }"|.
ENDIF.
IF iv_class IS NOT INITIAL.
lv_class = | { iv_class }|.
ENDIF.
IF lv_color IS NOT INITIAL.
lv_color = | { lv_color }|.
ENDIF.
lv_xpixel = cl_gui_cfw=>compute_pixel_from_metric( x_or_y = 'X'
in = 1 ).
IF lv_xpixel >= 2.
lv_large_icon = ' large'.
ENDIF.
rv_str = |<i class="icon{ lv_large_icon } icon-{ lv_name }{ lv_color }|.
rv_str = |{ rv_str }{ lv_class }"{ lv_onclick }{ lv_hint }></i>|.
ENDMETHOD. ENDMETHOD.

View File

@ -48,7 +48,7 @@ INTERFACE zif_abapgit_html PUBLIC.
IMPORTING IMPORTING
iv_id TYPE string iv_id TYPE string
iv_checked TYPE abap_bool OPTIONAL. iv_checked TYPE abap_bool OPTIONAL.
CLASS-METHODS a METHODS a
IMPORTING IMPORTING
!iv_txt TYPE string !iv_txt TYPE string
!iv_act TYPE string !iv_act TYPE string
@ -60,7 +60,7 @@ INTERFACE zif_abapgit_html PUBLIC.
!iv_title TYPE string OPTIONAL !iv_title TYPE string OPTIONAL
RETURNING RETURNING
VALUE(rv_str) TYPE string . VALUE(rv_str) TYPE string .
CLASS-METHODS icon METHODS icon
IMPORTING IMPORTING
!iv_name TYPE string !iv_name TYPE string
!iv_hint TYPE string OPTIONAL !iv_hint TYPE string OPTIONAL

View File

@ -324,7 +324,7 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION.
ENDIF. ENDIF.
ri_html->add( |<div class="{ lv_class }">| ). ri_html->add( |<div class="{ lv_class }">| ).
ri_html->add( |{ zcl_abapgit_html=>icon( 'exclamation-circle/red' ) } Error: { lv_error }| ). ri_html->add( |{ ri_html->icon( 'exclamation-circle/red' ) } Error: { lv_error }| ).
ri_html->add( '</div>' ). ri_html->add( '</div>' ).
ENDMETHOD. ENDMETHOD.
@ -516,7 +516,7 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION.
METHOD render_js_error_banner. METHOD render_js_error_banner.
CREATE OBJECT ri_html TYPE zcl_abapgit_html. CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( '<div id="js-error-banner" class="dummydiv error">' ). ri_html->add( '<div id="js-error-banner" class="dummydiv error">' ).
ri_html->add( |{ zcl_abapgit_html=>icon( 'exclamation-triangle/red' ) }| && ri_html->add( |{ ri_html->icon( 'exclamation-triangle/red' ) }| &&
' If this does not disappear soon,' && ' If this does not disappear soon,' &&
' then there is a JS init error, please log an issue' ). ' then there is a JS init error, please log an issue' ).
ri_html->add( '</div>' ). ri_html->add( '</div>' ).
@ -723,7 +723,7 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION.
ENDIF. ENDIF.
ri_html->add_a( iv_act = |toggleDisplay('news')| ri_html->add_a( iv_act = |toggleDisplay('news')|
iv_typ = zif_abapgit_html=>c_action_type-onclick iv_typ = zif_abapgit_html=>c_action_type-onclick
iv_txt = zcl_abapgit_html=>icon( iv_name = lv_icon iv_txt = ri_html->icon( iv_name = lv_icon
iv_class = 'pad-sides' iv_class = 'pad-sides'
iv_hint = 'Display changelog' ) ). iv_hint = 'Display changelog' ) ).
ENDIF. ENDIF.
@ -738,7 +738,7 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION.
lv_icon = 'star/grey'. lv_icon = 'star/grey'.
ENDIF. ENDIF.
ri_html->add_a( iv_act = |{ zif_abapgit_definitions=>c_action-repo_toggle_fav }?{ io_repo->get_key( ) }| ri_html->add_a( iv_act = |{ zif_abapgit_definitions=>c_action-repo_toggle_fav }?{ io_repo->get_key( ) }|
iv_txt = zcl_abapgit_html=>icon( iv_name = lv_icon iv_txt = ri_html->icon( iv_name = lv_icon
iv_class = 'pad-sides' iv_class = 'pad-sides'
iv_hint = 'Click to toggle favorite' ) ). iv_hint = 'Click to toggle favorite' ) ).
@ -800,8 +800,7 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION.
lv_commit_hash = io_repo_online->get_sha1_remote( ). lv_commit_hash = io_repo_online->get_sha1_remote( ).
lv_commit_short_hash = lv_commit_hash(7). lv_commit_short_hash = lv_commit_hash(7).
lv_icon_commit = ii_html->icon( iv_name = 'code-commit'
lv_icon_commit = zcl_abapgit_html=>icon( iv_name = 'code-commit'
iv_class = 'pad-sides' iv_class = 'pad-sides'
iv_hint = 'Commit' ). iv_hint = 'Commit' ).
@ -809,8 +808,7 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION.
lv_display_url = io_repo_online->get_commit_display_url( lv_commit_hash ). lv_display_url = io_repo_online->get_commit_display_url( lv_commit_hash ).
ii_html->add_a( iv_txt = |{ lv_icon_commit }{ lv_commit_short_hash }| ii_html->add_a( iv_txt = |{ lv_icon_commit }{ lv_commit_short_hash }|
iv_act = |{ zif_abapgit_definitions=>c_action-url }?| iv_act = |{ zif_abapgit_definitions=>c_action-url }?| && lv_display_url
&& lv_display_url
iv_class = |url| ). iv_class = |url| ).
CATCH zcx_abapgit_exception. CATCH zcx_abapgit_exception.
ii_html->add( |<span class="url">{ lv_icon_commit }{ lv_commit_short_hash }</span>| ). ii_html->add( |<span class="url">{ lv_icon_commit }{ lv_commit_short_hash }</span>| ).

View File

@ -26,12 +26,12 @@ CLASS zcl_abapgit_gui_page_bkg DEFINITION
IMPORTING IMPORTING
!is_per TYPE zcl_abapgit_persist_background=>ty_background !is_per TYPE zcl_abapgit_persist_background=>ty_background
RETURNING RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html . VALUE(ri_html) TYPE REF TO zif_abapgit_html .
METHODS render_settings METHODS render_settings
IMPORTING IMPORTING
!is_per TYPE zcl_abapgit_persist_background=>ty_background !is_per TYPE zcl_abapgit_persist_background=>ty_background
RETURNING RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html . VALUE(ri_html) TYPE REF TO zif_abapgit_html .
METHODS build_menu METHODS build_menu
RETURNING RETURNING
VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar .
@ -42,7 +42,7 @@ CLASS zcl_abapgit_gui_page_bkg DEFINITION
zcx_abapgit_exception . zcx_abapgit_exception .
METHODS render METHODS render
RETURNING RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING RAISING
zcx_abapgit_exception . zcx_abapgit_exception .
METHODS decode METHODS decode
@ -164,39 +164,39 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BKG IMPLEMENTATION.
ls_per = read_persist( lo_repo ). ls_per = read_persist( lo_repo ).
CREATE OBJECT ro_html. CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ro_html->add( '<div id="toc" class="settings_container">' ). ri_html->add( '<div id="toc" class="settings_container">' ).
ro_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( lo_repo ) ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( lo_repo ) ).
ro_html->add( '<br>' ). ri_html->add( '<br>' ).
ro_html->add( render_methods( ls_per ) ). ri_html->add( render_methods( ls_per ) ).
ro_html->add( '<u>HTTP Authentication, optional</u><br>' ). ri_html->add( '<u>HTTP Authentication, optional</u><br>' ).
ro_html->add( '(password will be saved in clear text)<br>' ). ri_html->add( '(password will be saved in clear text)<br>' ).
ro_html->add( '<table>' ). ri_html->add( '<table>' ).
ro_html->add( '<tr>' ). ri_html->add( '<tr>' ).
ro_html->add( '<td>Username:</td>' ). ri_html->add( '<td>Username:</td>' ).
ro_html->add( '<td><input type="text" name="username" value="' && ls_per-username && '"></td>' ). ri_html->add( '<td><input type="text" name="username" value="' && ls_per-username && '"></td>' ).
ro_html->add( '</tr>' ). ri_html->add( '</tr>' ).
ro_html->add( '<tr>' ). ri_html->add( '<tr>' ).
ro_html->add( '<td>Password:</td>' ). ri_html->add( '<td>Password:</td>' ).
ro_html->add( '<td><input type="text" name="password" value="' && ls_per-password && '"></td>' ). ri_html->add( '<td><input type="text" name="password" value="' && ls_per-password && '"></td>' ).
ro_html->add( '</tr>' ). ri_html->add( '</tr>' ).
ro_html->add( '</table>' ). ri_html->add( '</table>' ).
ro_html->add( '<br>' ). ri_html->add( '<br>' ).
ro_html->add( render_settings( ls_per ) ). ri_html->add( render_settings( ls_per ) ).
ro_html->add( '<br>' ). ri_html->add( '<br>' ).
ro_html->add( '<input type="submit" value="Save">' ). ri_html->add( '<input type="submit" value="Save">' ).
ro_html->add( '</form>' ). ri_html->add( '</form>' ).
ro_html->add( '<br>' ). ri_html->add( '<br>' ).
ro_html->add( '</div>' ). ri_html->add( '</div>' ).
ENDMETHOD. ENDMETHOD.
@ -217,18 +217,18 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BKG IMPLEMENTATION.
lv_checked TYPE string. lv_checked TYPE string.
CREATE OBJECT ro_html. CREATE OBJECT ri_html TYPE zcl_abapgit_html.
lt_methods = zcl_abapgit_background=>list_methods( ). lt_methods = zcl_abapgit_background=>list_methods( ).
ro_html->add( '<u>Method</u><br>' ). ri_html->add( '<u>Method</u><br>' ).
ro_html->add( |<form method="get" action="sapevent:{ zif_abapgit_definitions=>c_action-bg_update }">| ). ri_html->add( |<form method="get" action="sapevent:{ zif_abapgit_definitions=>c_action-bg_update }">| ).
IF is_per-method IS INITIAL. IF is_per-method IS INITIAL.
lv_checked = ' checked'. lv_checked = ' checked'.
ENDIF. ENDIF.
ro_html->add( '<input type="radio" name="method" value=""' && lv_checked && '>Do nothing<br>' ). ri_html->add( '<input type="radio" name="method" value=""' && lv_checked && '>Do nothing<br>' ).
LOOP AT lt_methods INTO ls_method. LOOP AT lt_methods INTO ls_method.
CLEAR lv_checked. CLEAR lv_checked.
@ -236,13 +236,13 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BKG IMPLEMENTATION.
lv_checked = ' checked'. lv_checked = ' checked'.
ENDIF. ENDIF.
ro_html->add( '<input type="radio" name="method" value="' && ri_html->add( '<input type="radio" name="method" value="' &&
ls_method-class && '"' && ls_method-class && '"' &&
lv_checked && '>' && lv_checked && '>' &&
ls_method-description && '<br>' ). ls_method-description && '<br>' ).
ENDLOOP. ENDLOOP.
ro_html->add( '<br>' ). ri_html->add( '<br>' ).
ENDMETHOD. ENDMETHOD.
@ -253,7 +253,7 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BKG IMPLEMENTATION.
ls_setting LIKE LINE OF lt_settings. ls_setting LIKE LINE OF lt_settings.
CREATE OBJECT ro_html. CREATE OBJECT ri_html TYPE zcl_abapgit_html.
IF is_per-method IS INITIAL. IF is_per-method IS INITIAL.
RETURN. RETURN.
@ -272,16 +272,16 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BKG IMPLEMENTATION.
RETURN. RETURN.
ENDIF. ENDIF.
ro_html->add( '<table>' ). ri_html->add( '<table>' ).
LOOP AT lt_settings INTO ls_setting. LOOP AT lt_settings INTO ls_setting.
ro_html->add( '<tr>' ). ri_html->add( '<tr>' ).
ro_html->add( '<td>' && ls_setting-key && ':</td>' ). ri_html->add( '<td>' && ls_setting-key && ':</td>' ).
ro_html->add( '<td><input type="text" name="' && ri_html->add( '<td><input type="text" name="' &&
ls_setting-key && '" value="' && ls_setting-key && '" value="' &&
ls_setting-value && '"></td>' ). ls_setting-value && '"></td>' ).
ro_html->add( '</tr>' ). ri_html->add( '</tr>' ).
ENDLOOP. ENDLOOP.
ro_html->add( '</table>' ). ri_html->add( '</table>' ).
ENDMETHOD. ENDMETHOD.

View File

@ -15,50 +15,68 @@ CLASS zcl_abapgit_gui_page_boverview DEFINITION
METHODS render_content REDEFINITION. METHODS render_content REDEFINITION.
PRIVATE SECTION. PRIVATE SECTION.
DATA: mo_repo TYPE REF TO zcl_abapgit_repo_online,
mv_compress TYPE abap_bool VALUE abap_false,
mt_commits TYPE zif_abapgit_definitions=>ty_commit_tt,
mi_branch_overview TYPE REF TO zif_abapgit_branch_overview.
CONSTANTS: BEGIN OF c_actions, TYPES:
BEGIN OF ty_merge,
source TYPE string,
target TYPE string,
END OF ty_merge .
DATA mo_repo TYPE REF TO zcl_abapgit_repo_online .
DATA mv_compress TYPE abap_bool VALUE abap_false ##NO_TEXT.
DATA mt_commits TYPE zif_abapgit_definitions=>ty_commit_tt .
DATA mi_branch_overview TYPE REF TO zif_abapgit_branch_overview .
CONSTANTS:
BEGIN OF c_actions,
uncompress TYPE string VALUE 'uncompress' ##NO_TEXT, uncompress TYPE string VALUE 'uncompress' ##NO_TEXT,
compress TYPE string VALUE 'compress' ##NO_TEXT, compress TYPE string VALUE 'compress' ##NO_TEXT,
refresh TYPE string VALUE 'refresh' ##NO_TEXT, refresh TYPE string VALUE 'refresh' ##NO_TEXT,
merge TYPE string VALUE 'merge' ##NO_TEXT, merge TYPE string VALUE 'merge' ##NO_TEXT,
END OF c_actions . END OF c_actions .
TYPES: BEGIN OF ty_merge, METHODS refresh
source TYPE string, RAISING
target TYPE string, zcx_abapgit_exception .
END OF ty_merge. METHODS body
RETURNING
METHODS: VALUE(ri_html) TYPE REF TO zif_abapgit_html
refresh RAISING
RAISING zcx_abapgit_exception, zcx_abapgit_exception .
body METHODS form_select
RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html IMPORTING
RAISING zcx_abapgit_exception, !iv_name TYPE string
form_select RETURNING
IMPORTING iv_name TYPE string VALUE(ri_html) TYPE REF TO zif_abapgit_html .
RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html, METHODS render_merge
render_merge RETURNING
RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING zcx_abapgit_exception, RAISING
decode_merge zcx_abapgit_exception .
IMPORTING it_postdata TYPE cnht_post_data_tab METHODS decode_merge
RETURNING VALUE(rs_merge) TYPE ty_merge IMPORTING
RAISING zcx_abapgit_exception, !it_postdata TYPE cnht_post_data_tab
build_menu RETURNING
RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar, VALUE(rs_merge) TYPE ty_merge
escape_branch RAISING
IMPORTING iv_string TYPE string zcx_abapgit_exception .
RETURNING VALUE(rv_string) TYPE string, METHODS build_menu
escape_message RETURNING
IMPORTING iv_string TYPE string VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar .
RETURNING VALUE(rv_string) TYPE string, METHODS escape_branch
render_commit_popups IMPORTING
RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html !iv_string TYPE string
RAISING zcx_abapgit_exception. RETURNING
VALUE(rv_string) TYPE string .
METHODS escape_message
IMPORTING
!iv_string TYPE string
RETURNING
VALUE(rv_string) TYPE string .
METHODS render_commit_popups
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
ENDCLASS. ENDCLASS.
@ -75,61 +93,61 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BOVERVIEW IMPLEMENTATION.
<ls_create> LIKE LINE OF <ls_commit>-create. <ls_create> LIKE LINE OF <ls_commit>-create.
CREATE OBJECT ro_html. CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ro_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top(
io_repo = mo_repo io_repo = mo_repo
iv_show_package = abap_false iv_show_package = abap_false
iv_show_branch = abap_false ) ). iv_show_branch = abap_false ) ).
ro_html->add( '<br>' ). ri_html->add( '<br>' ).
ro_html->add( '<br>' ). ri_html->add( '<br>' ).
ro_html->add( render_merge( ) ). ri_html->add( render_merge( ) ).
ro_html->add( '<br>' ). ri_html->add( '<br>' ).
ro_html->add( build_menu( )->render( ) ). ri_html->add( build_menu( )->render( ) ).
"CSS gitGraph-scrollWrapper, gitGraph-HTopScroller and gitGraph-Wrapper "CSS gitGraph-scrollWrapper, gitGraph-HTopScroller and gitGraph-Wrapper
" - Used to manage the Horizonal Scroll bar on top of gitGraph Element " - Used to manage the Horizonal Scroll bar on top of gitGraph Element
ro_html->add( '<div class="gitGraph-scrollWrapper" onscroll="GitGraphScroller()">' ). ri_html->add( '<div class="gitGraph-scrollWrapper" onscroll="GitGraphScroller()">' ).
"see http://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element "see http://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element
ro_html->add( '<div class="gitGraph-HTopScroller"></div>' ). ri_html->add( '<div class="gitGraph-HTopScroller"></div>' ).
ro_html->add( '</div>' ). ri_html->add( '</div>' ).
ro_html->add( '<div class="gitGraph-Wrapper">' ). ri_html->add( '<div class="gitGraph-Wrapper">' ).
ro_html->add( '<canvas id="gitGraph"></canvas>' ). ri_html->add( '<canvas id="gitGraph"></canvas>' ).
ro_html->add( '</div>' ). ri_html->add( '</div>' ).
ro_html->add( '<script type="text/javascript" src="https://cdnjs.' && ri_html->add( '<script type="text/javascript" src="https://cdnjs.' &&
'cloudflare.com/ajax/libs/gitgraph.js/1.14.0/gitgraph.min.js">' && 'cloudflare.com/ajax/libs/gitgraph.js/1.14.0/gitgraph.min.js">' &&
'</script>' ). '</script>' ).
ro_html->add( '<script type="text/javascript">' ). ri_html->add( '<script type="text/javascript">' ).
ro_html->add( 'var myTemplateConfig = {' ). ri_html->add( 'var myTemplateConfig = {' ).
ro_html->add( 'colors: [ "#979797", "#008fb5", "#f1c109", "' ri_html->add( 'colors: [ "#979797", "#008fb5", "#f1c109", "'
&& '#095256", "#087F8C", "#5AAA95", "#86A873", "#BB9F06" ],' ). && '#095256", "#087F8C", "#5AAA95", "#86A873", "#BB9F06" ],' ).
ro_html->add( 'branch: {' ). ri_html->add( 'branch: {' ).
ro_html->add( ' lineWidth: 8,' ). ri_html->add( ' lineWidth: 8,' ).
ro_html->add( ' spacingX: 50' ). ri_html->add( ' spacingX: 50' ).
ro_html->add( '},' ). ri_html->add( '},' ).
ro_html->add( 'commit: {' ). ri_html->add( 'commit: {' ).
ro_html->add( ' spacingY: -40,' ). ri_html->add( ' spacingY: -40,' ).
ro_html->add( ' dot: { size: 12 },' ). ri_html->add( ' dot: { size: 12 },' ).
ro_html->add( ' message: { font: "normal 14pt Arial" }' ). ri_html->add( ' message: { font: "normal 14pt Arial" }' ).
ro_html->add( '}' ). ri_html->add( '}' ).
ro_html->add( '};' ). ri_html->add( '};' ).
ro_html->add( 'var gitgraph = new GitGraph({' ). ri_html->add( 'var gitgraph = new GitGraph({' ).
ro_html->add( ' template: myTemplateConfig,' ). ri_html->add( ' template: myTemplateConfig,' ).
ro_html->add( ' orientation: "vertical-reverse"' ). ri_html->add( ' orientation: "vertical-reverse"' ).
ro_html->add( '});' ). ri_html->add( '});' ).
ro_html->add( 'var gBranchOveriew = new BranchOverview();' ). ri_html->add( 'var gBranchOveriew = new BranchOverview();' ).
LOOP AT mt_commits ASSIGNING <ls_commit>. LOOP AT mt_commits ASSIGNING <ls_commit>.
IF sy-tabix = 1. IF sy-tabix = 1.
" assumption: all branches are created from master, todo " assumption: all branches are created from master, todo
ro_html->add( |var { ri_html->add( |var {
escape_branch( <ls_commit>-branch ) } = gitgraph.branch("{ escape_branch( <ls_commit>-branch ) } = gitgraph.branch("{
<ls_commit>-branch }");| ). <ls_commit>-branch }");| ).
ENDIF. ENDIF.
@ -139,7 +157,7 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BOVERVIEW IMPLEMENTATION.
ENDIF. ENDIF.
IF <ls_commit>-compressed = abap_true. IF <ls_commit>-compressed = abap_true.
ro_html->add( |{ escape_branch( <ls_commit>-branch ) }.commit(\{message: "{ ri_html->add( |{ escape_branch( <ls_commit>-branch ) }.commit(\{message: "{
escape_message( <ls_commit>-message ) escape_message( <ls_commit>-message )
}", dotColor: "black", dotSize: 15, messageHashDisplay: false, messageAuthorDisplay: false\});| ). }", dotColor: "black", dotSize: 15, messageHashDisplay: false, messageAuthorDisplay: false\});| ).
ELSEIF <ls_commit>-merge IS INITIAL. ELSEIF <ls_commit>-merge IS INITIAL.
@ -151,7 +169,7 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BOVERVIEW IMPLEMENTATION.
lv_tag = concat_lines_of( table = <ls_commit>-tags lv_tag = concat_lines_of( table = <ls_commit>-tags
sep = ` | ` ). sep = ` | ` ).
ro_html->add( |{ escape_branch( <ls_commit>-branch ) }.commit(\{message: "{ ri_html->add( |{ escape_branch( <ls_commit>-branch ) }.commit(\{message: "{
escape_message( <ls_commit>-message ) }", long: "{ escape_message( concat_lines_of( table = <ls_commit>-body escape_message( <ls_commit>-message ) }", long: "{ escape_message( concat_lines_of( table = <ls_commit>-body
sep = ` ` ) ) sep = ` ` ) )
}", author: "{ }", author: "{
@ -159,7 +177,7 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BOVERVIEW IMPLEMENTATION.
<ls_commit>-sha1(7) }", tag: "{ lv_tag <ls_commit>-sha1(7) }", tag: "{ lv_tag
}", onClick:gBranchOveriew.onCommitClick.bind(gBranchOveriew)\});| ). }", onClick:gBranchOveriew.onCommitClick.bind(gBranchOveriew)\});| ).
ELSE. ELSE.
ro_html->add( |{ escape_branch( <ls_commit>-merge ) }.merge({ ri_html->add( |{ escape_branch( <ls_commit>-merge ) }.merge({
escape_branch( <ls_commit>-branch ) }, \{message: "{ escape_branch( <ls_commit>-branch ) }, \{message: "{
escape_message( <ls_commit>-message ) }", long: "{ escape_message( concat_lines_of( table = <ls_commit>-body escape_message( <ls_commit>-message ) }", long: "{ escape_message( concat_lines_of( table = <ls_commit>-body
sep = ` ` ) ) sep = ` ` ) )
@ -174,25 +192,25 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BOVERVIEW IMPLEMENTATION.
lv_branch_display_name = <ls_create>-name. lv_branch_display_name = <ls_create>-name.
ENDIF. ENDIF.
ro_html->add( |var { escape_branch( <ls_create>-name ) } = { ri_html->add( |var { escape_branch( <ls_create>-name ) } = {
escape_branch( <ls_create>-parent ) }.branch("{ escape_branch( <ls_create>-parent ) }.branch("{
lv_branch_display_name }");| ). lv_branch_display_name }");| ).
ENDLOOP. ENDLOOP.
ENDLOOP. ENDLOOP.
ro_html->add( ri_html->add(
|gitGraph.addEventListener( "commit:mouseover", gBranchOveriew.showCommit.bind(gBranchOveriew) );| ). |gitGraph.addEventListener( "commit:mouseover", gBranchOveriew.showCommit.bind(gBranchOveriew) );| ).
ro_html->add( ri_html->add(
|gitGraph.addEventListener( "commit:mouseout", gBranchOveriew.hideCommit.bind(gBranchOveriew) );| ). |gitGraph.addEventListener( "commit:mouseout", gBranchOveriew.hideCommit.bind(gBranchOveriew) );| ).
ro_html->add( '</script>' ). ri_html->add( '</script>' ).
ro_html->add( '<script>' ). ri_html->add( '<script>' ).
ro_html->add( 'setGitGraphScroller();' ). ri_html->add( 'setGitGraphScroller();' ).
ro_html->add( '</script>' ). ri_html->add( '</script>' ).
ro_html->add( render_commit_popups( ) ). ri_html->add( render_commit_popups( ) ).
ENDMETHOD. ENDMETHOD.
@ -277,16 +295,16 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BOVERVIEW IMPLEMENTATION.
FIELD-SYMBOLS: <ls_branch> LIKE LINE OF lt_branches. FIELD-SYMBOLS: <ls_branch> LIKE LINE OF lt_branches.
CREATE OBJECT ro_html. CREATE OBJECT ri_html TYPE zcl_abapgit_html.
lt_branches = mi_branch_overview->get_branches( ). lt_branches = mi_branch_overview->get_branches( ).
ro_html->add( |<select name="{ iv_name }">| ). ri_html->add( |<select name="{ iv_name }">| ).
LOOP AT lt_branches ASSIGNING <ls_branch>. LOOP AT lt_branches ASSIGNING <ls_branch>.
lv_name = <ls_branch>-name+11. lv_name = <ls_branch>-name+11.
ro_html->add( |<option value="{ lv_name }">{ lv_name }</option>| ). ri_html->add( |<option value="{ lv_name }">{ lv_name }</option>| ).
ENDLOOP. ENDLOOP.
ro_html->add( '</select>' ). ri_html->add( '</select>' ).
ENDMETHOD. ENDMETHOD.
@ -311,7 +329,7 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BOVERVIEW IMPLEMENTATION.
FIELD-SYMBOLS: <ls_commit> LIKE LINE OF mt_commits. FIELD-SYMBOLS: <ls_commit> LIKE LINE OF mt_commits.
CREATE OBJECT ro_html. CREATE OBJECT ri_html TYPE zcl_abapgit_html.
LOOP AT mt_commits ASSIGNING <ls_commit>. LOOP AT mt_commits ASSIGNING <ls_commit>.
@ -352,13 +370,12 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BOVERVIEW IMPLEMENTATION.
&& | </tr>| && | </tr>|
&& |</table>|. && |</table>|.
ro_html->add( zcl_abapgit_gui_chunk_lib=>render_commit_popup( iv_id = <ls_commit>-sha1(7) ri_html->add( zcl_abapgit_gui_chunk_lib=>render_commit_popup(
iv_id = <ls_commit>-sha1(7)
iv_content = lv_content ) ). iv_content = lv_content ) ).
ENDLOOP. ENDLOOP.
ENDMETHOD. ENDMETHOD.
@ -375,15 +392,15 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_BOVERVIEW IMPLEMENTATION.
METHOD render_merge. METHOD render_merge.
CREATE OBJECT ro_html. CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ro_html->add( '<form id="commit_form" method="post" action="sapevent:merge">' ). ri_html->add( '<form id="commit_form" method="post" action="sapevent:merge">' ).
ro_html->add( 'Merge' ). ri_html->add( 'Merge' ).
ro_html->add( form_select( 'source' ) ). ri_html->add( form_select( 'source' ) ).
ro_html->add( 'into' ). ri_html->add( 'into' ).
ro_html->add( form_select( 'target' ) ). ri_html->add( form_select( 'target' ) ).
ro_html->add( '<input type="submit" value="Submit">' ). ri_html->add( '<input type="submit" value="Submit">' ).
ro_html->add( '</form>' ). ri_html->add( '</form>' ).
ENDMETHOD. ENDMETHOD.

View File

@ -48,12 +48,15 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_DEBUGINFO IMPLEMENTATION.
METHOD get_jump_class. METHOD get_jump_class.
DATA: lv_encode TYPE string. DATA lv_encode TYPE string.
DATA li_html TYPE REF TO zif_abapgit_html.
CREATE OBJECT li_html TYPE zcl_abapgit_html.
lv_encode = zcl_abapgit_html_action_utils=>jump_encode( iv_obj_type = 'CLAS' lv_encode = zcl_abapgit_html_action_utils=>jump_encode( iv_obj_type = 'CLAS'
iv_obj_name = |{ iv_class }| ). iv_obj_name = |{ iv_class }| ).
rv_html = zcl_abapgit_html=>zif_abapgit_html~a( rv_html = li_html->a(
iv_txt = |{ iv_class }| iv_txt = |{ iv_class }|
iv_act = |{ zif_abapgit_definitions=>c_action-jump }?{ lv_encode }| ). iv_act = |{ zif_abapgit_definitions=>c_action-jump }?{ lv_encode }| ).

View File

@ -73,7 +73,7 @@ CLASS zcl_abapgit_gui_page_patch DEFINITION
zcx_abapgit_exception . zcx_abapgit_exception .
METHODS render_patch_head METHODS render_patch_head
IMPORTING IMPORTING
!io_html TYPE REF TO zcl_abapgit_html !ii_html TYPE REF TO zif_abapgit_html
!is_diff TYPE ty_file_diff . !is_diff TYPE ty_file_diff .
METHODS start_staging METHODS start_staging
IMPORTING IMPORTING
@ -152,7 +152,7 @@ CLASS zcl_abapgit_gui_page_patch DEFINITION
VALUE(rv_is_patch_line_possible) TYPE abap_bool . VALUE(rv_is_patch_line_possible) TYPE abap_bool .
METHODS render_scripts METHODS render_scripts
RETURNING RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING RAISING
zcx_abapgit_exception . zcx_abapgit_exception .
ENDCLASS. ENDCLASS.
@ -664,27 +664,27 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_PATCH IMPLEMENTATION.
METHOD render_patch_head. METHOD render_patch_head.
io_html->add( |<th class="patch">| ). ii_html->add( |<th class="patch">| ).
io_html->add_checkbox( iv_id = |patch_file_{ get_normalized_fname_with_path( is_diff ) }| ). ii_html->add_checkbox( |patch_file_{ get_normalized_fname_with_path( is_diff ) }| ).
io_html->add( '</th>' ). ii_html->add( '</th>' ).
ENDMETHOD. ENDMETHOD.
METHOD render_scripts. METHOD render_scripts.
CREATE OBJECT ro_html. CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ro_html->zif_abapgit_html~set_title( cl_abap_typedescr=>describe_by_object_ref( me )->get_relative_name( ) ). ri_html->set_title( cl_abap_typedescr=>describe_by_object_ref( me )->get_relative_name( ) ).
ro_html->add( 'preparePatch();' ). ri_html->add( 'preparePatch();' ).
ro_html->add( 'registerStagePatch();' ). ri_html->add( 'registerStagePatch();' ).
ENDMETHOD. ENDMETHOD.
METHOD render_table_head_non_unified. METHOD render_table_head_non_unified.
render_patch_head( io_html = io_html render_patch_head( ii_html = io_html
is_diff = is_diff ). is_diff = is_diff ).
super->render_table_head_non_unified( super->render_table_head_non_unified(

View File

@ -312,14 +312,17 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_VIEW_REPO IMPLEMENTATION.
METHOD build_dir_jump_link. METHOD build_dir_jump_link.
DATA: lv_path TYPE string, DATA lv_path TYPE string.
lv_encode TYPE string. DATA lv_encode TYPE string.
DATA li_html TYPE REF TO zif_abapgit_html.
CREATE OBJECT li_html TYPE zcl_abapgit_html.
lv_path = iv_path. lv_path = iv_path.
REPLACE FIRST OCCURRENCE OF mv_cur_dir IN lv_path WITH ''. REPLACE FIRST OCCURRENCE OF mv_cur_dir IN lv_path WITH ''.
lv_encode = zcl_abapgit_html_action_utils=>dir_encode( lv_path ). lv_encode = zcl_abapgit_html_action_utils=>dir_encode( lv_path ).
rv_html = zcl_abapgit_html=>zif_abapgit_html~a( rv_html = li_html->a(
iv_txt = lv_path iv_txt = lv_path
iv_act = |{ c_actions-change_dir }?{ lv_encode }| ). iv_act = |{ c_actions-change_dir }?{ lv_encode }| ).
@ -464,13 +467,16 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_VIEW_REPO IMPLEMENTATION.
METHOD build_obj_jump_link. METHOD build_obj_jump_link.
DATA: lv_encode TYPE string. DATA lv_encode TYPE string.
DATA li_html TYPE REF TO zif_abapgit_html.
CREATE OBJECT li_html TYPE zcl_abapgit_html.
lv_encode = zcl_abapgit_html_action_utils=>jump_encode( lv_encode = zcl_abapgit_html_action_utils=>jump_encode(
iv_obj_type = is_item-obj_type iv_obj_type = is_item-obj_type
iv_obj_name = is_item-obj_name ). iv_obj_name = is_item-obj_name ).
rv_html = zcl_abapgit_html=>zif_abapgit_html~a( rv_html = li_html->a(
iv_txt = |{ is_item-obj_name }| iv_txt = |{ is_item-obj_name }|
iv_act = |{ zif_abapgit_definitions=>c_action-jump }?{ lv_encode }| ). iv_act = |{ zif_abapgit_definitions=>c_action-jump }?{ lv_encode }| ).
@ -961,10 +967,14 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_VIEW_REPO IMPLEMENTATION.
METHOD render_item_lock_column. METHOD render_item_lock_column.
DATA: li_cts_api TYPE REF TO zif_abapgit_cts_api,
lv_transport TYPE trkorr, DATA li_cts_api TYPE REF TO zif_abapgit_cts_api.
lv_transport_string TYPE string, DATA lv_transport TYPE trkorr.
lv_icon_html TYPE string. DATA lv_transport_string TYPE string.
DATA lv_icon_html TYPE string.
DATA li_html TYPE REF TO zif_abapgit_html.
CREATE OBJECT li_html TYPE zcl_abapgit_html.
li_cts_api = zcl_abapgit_factory=>get_cts_api( ). li_cts_api = zcl_abapgit_factory=>get_cts_api( ).
@ -979,8 +989,8 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_VIEW_REPO IMPLEMENTATION.
iv_object_name = is_item-obj_name iv_object_name = is_item-obj_name
iv_resolve_task_to_request = abap_false ). iv_resolve_task_to_request = abap_false ).
lv_transport_string = lv_transport. lv_transport_string = lv_transport.
lv_icon_html = zcl_abapgit_html=>zif_abapgit_html~a( lv_icon_html = li_html->a(
iv_txt = zcl_abapgit_html=>icon( iv_name = 'briefcase/darkgrey' iv_txt = li_html->icon( iv_name = 'briefcase/darkgrey'
iv_hint = lv_transport_string ) iv_hint = lv_transport_string )
iv_act = |{ zif_abapgit_definitions=>c_action-jump_transport }?| && lv_transport ). iv_act = |{ zif_abapgit_definitions=>c_action-jump_transport }?| && lv_transport ).

View File

@ -251,14 +251,14 @@ CLASS ZCL_ABAPGIT_GUI_REPO_OVER IMPLEMENTATION.
ii_html->add( |<input type="submit" class="hidden-submit">| ). ii_html->add( |<input type="submit" class="hidden-submit">| ).
ii_html->add( |</form>| ). ii_html->add( |</form>| ).
ii_html->add( zcl_abapgit_html=>zif_abapgit_html~a( ii_html->add( ii_html->a(
iv_txt = '<i id="icon-filter-favorite" class="icon icon-check"></i> Only Favorites' iv_txt = '<i id="icon-filter-favorite" class="icon icon-check"></i> Only Favorites'
iv_act = |gHelper.toggleRepoListFavorites()| iv_act = |gHelper.toggleRepoListFavorites()|
iv_typ = zif_abapgit_html=>c_action_type-onclick ) ). iv_typ = zif_abapgit_html=>c_action_type-onclick ) ).
ii_html->add( `<span class="separator">|</span>` ). ii_html->add( `<span class="separator">|</span>` ).
ii_html->add( zcl_abapgit_html=>zif_abapgit_html~a( ii_html->add( ii_html->a(
iv_txt = '<i id="icon-filter-detail" class="icon icon-check"></i> Detail' iv_txt = '<i id="icon-filter-detail" class="icon icon-check"></i> Detail'
iv_act = |gHelper.toggleRepoListDetail()| iv_act = |gHelper.toggleRepoListDetail()|
iv_typ = zif_abapgit_html=>c_action_type-onclick ) ). iv_typ = zif_abapgit_html=>c_action_type-onclick ) ).