From b91ab3d9bd17f05fc9d5ca7b5abc0a20ae28f0cf Mon Sep 17 00:00:00 2001 From: sbcgua Date: Thu, 12 Jan 2017 15:35:40 +0200 Subject: [PATCH 1/4] fix highlighting bug after page_diff refactoring --- src/zabapgit_css_common.w3mi.data.css | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/zabapgit_css_common.w3mi.data.css b/src/zabapgit_css_common.w3mi.data.css index 8db14ac39..8da217de9 100644 --- a/src/zabapgit_css_common.w3mi.data.css +++ b/src/zabapgit_css_common.w3mi.data.css @@ -519,19 +519,17 @@ table.diff_tab code { white-space: pre; } table.diff_tab td.code { - /* font-family: inherit; */ - /* white-space: pre; */ word-wrap: break-word; white-space: pre-wrap; overflow: visible; } -table.diff_tab code span.keyword { color: #0a69ce; } -table.diff_tab code span.text { color: #48ce4f; } -table.diff_tab code span.comment { color: #808080; font-style: italic; } -table.diff_tab code span.xml_tag { color: #457ce3; } -table.diff_tab code span.attr { color: #b777fb; } -table.diff_tab code span.attr_val { color: #7a02f9; } +table.diff_tab .code span.keyword { color: #0a69ce; } +table.diff_tab .code span.text { color: #48ce4f; } +table.diff_tab .code span.comment { color: #808080; font-style: italic; } +table.diff_tab .code span.xml_tag { color: #457ce3; } +table.diff_tab .code span.attr { color: #b777fb; } +table.diff_tab .code span.attr_val { color: #7a02f9; } table.diff_tab tbody tr:first-child td { padding-top: 0.5em; } table.diff_tab tbody tr:last-child td { padding-bottom: 0.5em; } From f76b1bfce0e53aae1b864c2d273e032daf54ceb3 Mon Sep 17 00:00:00 2001 From: sbcgua Date: Thu, 12 Jan 2017 16:52:17 +0200 Subject: [PATCH 2/4] HEAD in select branch dialog #531 normilize branch name for new branches -> substitute space to '-' --- src/zabapgit_git_helpers.prog.abap | 26 +++++++++++++++--- src/zabapgit_html_chunks.prog.abap | 3 +- src/zabapgit_popups.prog.abap | 44 ++++++++++++++++++++++-------- 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/src/zabapgit_git_helpers.prog.abap b/src/zabapgit_git_helpers.prog.abap index 41fe042a5..257730392 100644 --- a/src/zabapgit_git_helpers.prog.abap +++ b/src/zabapgit_git_helpers.prog.abap @@ -111,7 +111,7 @@ CLASS lcl_git_branch_list DEFINITION FINAL. tag TYPE ty_git_branch_type VALUE 'TG', other TYPE ty_git_branch_type VALUE 'ZZ', END OF c_type. - CONSTANTS head_name TYPE string VALUE 'HEAD'. + CONSTANTS c_head_name TYPE string VALUE 'HEAD'. METHODS constructor IMPORTING iv_data TYPE string @@ -126,6 +126,9 @@ CLASS lcl_git_branch_list DEFINITION FINAL. RETURNING VALUE(rs_branch) TYPE ty_git_branch RAISING lcx_exception. + METHODS get_head_symref + RETURNING VALUE(rv_head_symref) TYPE string. + METHODS get_branches_only RETURNING VALUE(rt_branches) TYPE ty_git_branch_list_tt RAISING lcx_exception. @@ -150,6 +153,10 @@ CLASS lcl_git_branch_list DEFINITION FINAL. IMPORTING iv_branch_name TYPE clike RETURNING VALUE(rv_name) TYPE string. + CLASS-METHODS normalize_branch_name + IMPORTING iv_branch_name TYPE clike + RETURNING VALUE(rv_name) TYPE string. + PRIVATE SECTION. DATA mt_branches TYPE ty_git_branch_list_tt. DATA mv_head_symref TYPE string. @@ -178,6 +185,10 @@ CLASS lcl_git_branch_list IMPLEMENTATION. ev_head_symref = me->mv_head_symref ). ENDMETHOD. "create + METHOD get_head_symref. + rv_head_symref = mv_head_symref. + ENDMETHOD. " get_head_symref. + METHOD find_by_name. IF iv_branch_name IS INITIAL. @@ -197,7 +208,7 @@ CLASS lcl_git_branch_list IMPLEMENTATION. IF mv_head_symref IS NOT INITIAL. rs_branch = find_by_name( mv_head_symref ). ELSE. - rs_branch = find_by_name( head_name ). + rs_branch = find_by_name( c_head_name ). ENDIF. ENDMETHOD. "get_head @@ -246,7 +257,7 @@ CLASS lcl_git_branch_list IMPLEMENTATION. -name = lv_name. -display_name = get_display_name( lv_name ). -type = get_type( lv_name ). - IF -name = head_name OR -name = ev_head_symref. + IF -name = c_head_name OR -name = ev_head_symref. -is_head = abap_true. ENDIF. ENDLOOP. @@ -295,7 +306,7 @@ CLASS lcl_git_branch_list IMPLEMENTATION. METHOD get_type. rv_type = c_type-other. - IF iv_branch_name CP 'refs/heads/*' OR iv_branch_name = head_name. + IF iv_branch_name CP 'refs/heads/*' OR iv_branch_name = c_head_name. rv_type = c_type-branch. RETURN. ENDIF. @@ -334,4 +345,11 @@ CLASS lcl_git_branch_list IMPLEMENTATION. ENDLOOP. ENDMETHOD. "get_tags_only + METHOD normalize_branch_name. + + rv_name = iv_branch_name. " Force convert to string + REPLACE ALL OCCURRENCES OF ` ` IN rv_name WITH '-'. " Disallow space in branch name + + ENDMETHOD. " normalize_branch_name. + ENDCLASS. "lcl_git_branch_list \ No newline at end of file diff --git a/src/zabapgit_html_chunks.prog.abap b/src/zabapgit_html_chunks.prog.abap index 79d4b4fed..0161e66dd 100644 --- a/src/zabapgit_html_chunks.prog.abap +++ b/src/zabapgit_html_chunks.prog.abap @@ -162,7 +162,8 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION. lv_text = lcl_git_branch_list=>get_display_name( iv_branch ). - IF iv_branch = io_repo->get_head_branch_name( ) OR iv_branch = lcl_git_branch_list=>head_name. + IF iv_branch = io_repo->get_head_branch_name( ) + OR iv_branch = lcl_git_branch_list=>c_head_name. lv_class = 'branch branch_head'. ELSEIF lcl_git_branch_list=>get_type( iv_branch ) = lcl_git_branch_list=>c_type-branch. lv_class = 'branch branch_branch'. diff --git a/src/zabapgit_popups.prog.abap b/src/zabapgit_popups.prog.abap index 6ee6af2f0..ff7a4238f 100644 --- a/src/zabapgit_popups.prog.abap +++ b/src/zabapgit_popups.prog.abap @@ -174,7 +174,7 @@ CLASS lcl_popups IMPLEMENTATION. CLEAR: ev_name, ev_cancel. * TAB FLD LABEL DEF ATTR - _add_dialog_fld 'TEXTL' 'LINE' 'Name' 'new_branch_name' ''. + _add_dialog_fld 'TEXTL' 'LINE' 'Name' 'new-branch-name' ''. CALL FUNCTION 'POPUP_GET_VALUES' EXPORTING @@ -195,7 +195,8 @@ CLASS lcl_popups IMPLEMENTATION. ELSE. READ TABLE lt_fields INDEX 1 ASSIGNING . ASSERT sy-subrc = 0. - ev_name = lcl_git_branch_list=>complete_heads_branch_name( -value ). + ev_name = lcl_git_branch_list=>complete_heads_branch_name( + lcl_git_branch_list=>normalize_branch_name( -value ) ). ENDIF. ENDMETHOD. @@ -282,26 +283,42 @@ CLASS lcl_popups IMPLEMENTATION. METHOD branch_list_popup. - DATA: lo_branches TYPE REF TO lcl_git_branch_list, - lt_branches TYPE lcl_git_branch_list=>ty_git_branch_list_tt, - lv_answer TYPE c LENGTH 1, - lv_default TYPE i VALUE 1, "Default cursor position - lt_selection TYPE TABLE OF spopli. + DATA: lo_branches TYPE REF TO lcl_git_branch_list, + lt_branches TYPE lcl_git_branch_list=>ty_git_branch_list_tt, + lv_head_suffix TYPE string, + lv_answer TYPE c LENGTH 1, + lv_default TYPE i VALUE 1, "Default cursor position + lt_selection TYPE TABLE OF spopli. FIELD-SYMBOLS: LIKE LINE OF lt_selection, LIKE LINE OF lt_branches. - lo_branches = lcl_git_transport=>branches( iv_url ). + lo_branches = lcl_git_transport=>branches( iv_url ). + lt_branches = lo_branches->get_branches_only( ). + lv_head_suffix = | ({ lcl_git_branch_list=>c_head_name })|. - lt_branches = lo_branches->get_branches_only( ). LOOP AT lt_branches ASSIGNING . - APPEND INITIAL LINE TO lt_selection ASSIGNING . - -varoption = -name. + IF -name = lcl_git_branch_list=>c_head_name + AND -name <> lo_branches->get_head_symref( ). + " HEAD but other HEAD symref exist + CONTINUE. + ENDIF. + + APPEND INITIAL LINE TO lt_selection ASSIGNING . IF iv_default_branch IS NOT INITIAL AND iv_default_branch = -name. lv_default = sy-tabix. ENDIF. + + IF -name = lo_branches->get_head_symref( ) + AND -name <> lcl_git_branch_list=>c_head_name. + " HEAD symref but not HEAD itself + -varoption = -display_name && lv_head_suffix. + ELSE. + -varoption = -display_name. + ENDIF. + ENDLOOP. IF iv_show_new_option = abap_true. @@ -339,7 +356,10 @@ CLASS lcl_popups IMPLEMENTATION. IF iv_show_new_option = abap_true AND -varoption = c_new_branch_label. rs_branch-name = c_new_branch_label. ELSE. - rs_branch = lo_branches->find_by_name( -varoption ). + REPLACE FIRST OCCURRENCE OF lv_head_suffix IN -varoption WITH ''. + READ TABLE lt_branches WITH KEY display_name = -varoption ASSIGNING . + ASSERT sy-subrc = 0. + rs_branch = lo_branches->find_by_name( -name ). ENDIF. From ea28fdfd7b4130c3a22ea97b345157ae0bbf286e Mon Sep 17 00:00:00 2001 From: sbcgua Date: Thu, 12 Jan 2017 17:11:32 +0200 Subject: [PATCH 3/4] small fix for html intentation at page_main --- src/zabapgit_html.prog.abap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/zabapgit_html.prog.abap b/src/zabapgit_html.prog.abap index 1bddb868f..e6ac84d75 100644 --- a/src/zabapgit_html.prog.abap +++ b/src/zabapgit_html.prog.abap @@ -426,7 +426,8 @@ CLASS lcl_html_toolbar IMPLEMENTATION. ENDIF. IF lv_is_drop = abap_true. " Dropdown - ro_html->add( '' ). + ro_html->add( '' ). + ro_html->add( '' ). ENDIF. ro_html->add( '' ). From ab706e6d6b82b0db640ef08940be9193578c0801 Mon Sep 17 00:00:00 2001 From: sbcgua Date: Thu, 12 Jan 2017 17:28:03 +0200 Subject: [PATCH 4/4] remove "menu_end" logic, moved to CSS --- src/zabapgit_css_common.w3mi.data.css | 15 ++++++++++++++- src/zabapgit_css_common.w3mi.xml | 2 +- src/zabapgit_html.prog.abap | 24 ++++-------------------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/zabapgit_css_common.w3mi.data.css b/src/zabapgit_css_common.w3mi.data.css index 8da217de9..95d64ab1e 100644 --- a/src/zabapgit_css_common.w3mi.data.css +++ b/src/zabapgit_css_common.w3mi.data.css @@ -111,9 +111,22 @@ div.menu .menu_end { border-right: 0px !important; } div.menu a { padding-left: 0.5em; padding-right: 0.5em; - border-right: 1px solid lightgrey; font-size: 12pt; } + +div.menu > a { + border-right: 1px solid lightgrey; +} +div.menu > div.dropdown > a { + border-right: 1px solid lightgrey; +} +div.menu > a:last-child { + border-right: 0px !important; +} +div.menu > div.dropdown:last-child > a { + border-right: 0px !important; +} + div.menu_vertical { display: inline; } div.menu_vertical a { display: block; diff --git a/src/zabapgit_css_common.w3mi.xml b/src/zabapgit_css_common.w3mi.xml index 10d1ffd0d..7f7372fc2 100644 --- a/src/zabapgit_css_common.w3mi.xml +++ b/src/zabapgit_css_common.w3mi.xml @@ -3,7 +3,7 @@ ZABAPGIT_CSS_COMMON - AbapGit common styles + MI diff --git a/src/zabapgit_html.prog.abap b/src/zabapgit_html.prog.abap index e6ac84d75..340f7fadb 100644 --- a/src/zabapgit_html.prog.abap +++ b/src/zabapgit_html.prog.abap @@ -332,8 +332,7 @@ CLASS lcl_html_toolbar IMPLEMENTATION. METHOD render. "TODO refactor DATA: lv_class TYPE string, - lv_is_drop TYPE abap_bool, - lv_last TYPE abap_bool. + lv_is_drop TYPE abap_bool. FIELD-SYMBOLS LIKE LINE OF mt_items. @@ -359,13 +358,8 @@ CLASS lcl_html_toolbar IMPLEMENTATION. IF iv_as_angle = abap_true. ro_html->add( '
' ). ELSE. - lv_class = 'dropbtn'. - IF iv_no_separator = abap_true. - lv_class = lv_class && ' menu_end' ##NO_TEXT. - ENDIF. - ro_html->add_a( iv_txt = iv_as_droplist_with_label - iv_class = lv_class + iv_class = 'dropbtn' iv_act = '' ). ENDIF. @@ -386,15 +380,8 @@ CLASS lcl_html_toolbar IMPLEMENTATION. ENDIF. LOOP AT mt_items ASSIGNING . - lv_last = boolc( sy-tabix = lines( mt_items ) ). IF -sub IS INITIAL. - CLEAR lv_class. - IF iv_no_separator = abap_true - OR lv_last = abap_true - AND iv_as_droplist_with_label IS INITIAL. - lv_class = 'menu_end'. - ENDIF. IF iv_with_icons = abap_true. ro_html->add( '' ). @@ -405,8 +392,7 @@ CLASS lcl_html_toolbar IMPLEMENTATION. ro_html->add_a( iv_txt = -txt iv_act = -act iv_opt = -opt - iv_typ = -typ - iv_class = lv_class ). + iv_typ = -typ ). IF iv_with_icons = abap_true. ro_html->add( '' ). @@ -414,9 +400,7 @@ CLASS lcl_html_toolbar IMPLEMENTATION. ENDIF. ELSE. - ro_html->add( -sub->render( - iv_as_droplist_with_label = -txt - iv_no_separator = lv_last ) ). + ro_html->add( -sub->render( iv_as_droplist_with_label = -txt ) ). ENDIF. ENDLOOP.