mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-02 13:03:01 +08:00
Merge pull request #534 from sbcgua/master
HEAD in select branch dialog & highlighting css bug fix
This commit is contained in:
commit
73441ce92f
|
@ -111,9 +111,22 @@ div.menu .menu_end { border-right: 0px !important; }
|
||||||
div.menu a {
|
div.menu a {
|
||||||
padding-left: 0.5em;
|
padding-left: 0.5em;
|
||||||
padding-right: 0.5em;
|
padding-right: 0.5em;
|
||||||
border-right: 1px solid lightgrey;
|
|
||||||
font-size: 12pt;
|
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 { display: inline; }
|
||||||
div.menu_vertical a {
|
div.menu_vertical a {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -519,19 +532,17 @@ table.diff_tab code {
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
}
|
}
|
||||||
table.diff_tab td.code {
|
table.diff_tab td.code {
|
||||||
/* font-family: inherit; */
|
|
||||||
/* white-space: pre; */
|
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.diff_tab code span.keyword { color: #0a69ce; }
|
table.diff_tab .code span.keyword { color: #0a69ce; }
|
||||||
table.diff_tab code span.text { color: #48ce4f; }
|
table.diff_tab .code span.text { color: #48ce4f; }
|
||||||
table.diff_tab code span.comment { color: #808080; font-style: italic; }
|
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.xml_tag { color: #457ce3; }
|
||||||
table.diff_tab code span.attr { color: #b777fb; }
|
table.diff_tab .code span.attr { color: #b777fb; }
|
||||||
table.diff_tab code span.attr_val { color: #7a02f9; }
|
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:first-child td { padding-top: 0.5em; }
|
||||||
table.diff_tab tbody tr:last-child td { padding-bottom: 0.5em; }
|
table.diff_tab tbody tr:last-child td { padding-bottom: 0.5em; }
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
<asx:values>
|
<asx:values>
|
||||||
<NAME>ZABAPGIT_CSS_COMMON</NAME>
|
<NAME>ZABAPGIT_CSS_COMMON</NAME>
|
||||||
<TEXT>AbapGit common styles</TEXT>
|
<TEXT/>
|
||||||
<PARAMS>
|
<PARAMS>
|
||||||
<WWWPARAMS>
|
<WWWPARAMS>
|
||||||
<RELID>MI</RELID>
|
<RELID>MI</RELID>
|
||||||
|
|
|
@ -111,7 +111,7 @@ CLASS lcl_git_branch_list DEFINITION FINAL.
|
||||||
tag TYPE ty_git_branch_type VALUE 'TG',
|
tag TYPE ty_git_branch_type VALUE 'TG',
|
||||||
other TYPE ty_git_branch_type VALUE 'ZZ',
|
other TYPE ty_git_branch_type VALUE 'ZZ',
|
||||||
END OF c_type.
|
END OF c_type.
|
||||||
CONSTANTS head_name TYPE string VALUE 'HEAD'.
|
CONSTANTS c_head_name TYPE string VALUE 'HEAD'.
|
||||||
|
|
||||||
METHODS constructor
|
METHODS constructor
|
||||||
IMPORTING iv_data TYPE string
|
IMPORTING iv_data TYPE string
|
||||||
|
@ -126,6 +126,9 @@ CLASS lcl_git_branch_list DEFINITION FINAL.
|
||||||
RETURNING VALUE(rs_branch) TYPE ty_git_branch
|
RETURNING VALUE(rs_branch) TYPE ty_git_branch
|
||||||
RAISING lcx_exception.
|
RAISING lcx_exception.
|
||||||
|
|
||||||
|
METHODS get_head_symref
|
||||||
|
RETURNING VALUE(rv_head_symref) TYPE string.
|
||||||
|
|
||||||
METHODS get_branches_only
|
METHODS get_branches_only
|
||||||
RETURNING VALUE(rt_branches) TYPE ty_git_branch_list_tt
|
RETURNING VALUE(rt_branches) TYPE ty_git_branch_list_tt
|
||||||
RAISING lcx_exception.
|
RAISING lcx_exception.
|
||||||
|
@ -150,6 +153,10 @@ CLASS lcl_git_branch_list DEFINITION FINAL.
|
||||||
IMPORTING iv_branch_name TYPE clike
|
IMPORTING iv_branch_name TYPE clike
|
||||||
RETURNING VALUE(rv_name) TYPE string.
|
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.
|
PRIVATE SECTION.
|
||||||
DATA mt_branches TYPE ty_git_branch_list_tt.
|
DATA mt_branches TYPE ty_git_branch_list_tt.
|
||||||
DATA mv_head_symref TYPE string.
|
DATA mv_head_symref TYPE string.
|
||||||
|
@ -178,6 +185,10 @@ CLASS lcl_git_branch_list IMPLEMENTATION.
|
||||||
ev_head_symref = me->mv_head_symref ).
|
ev_head_symref = me->mv_head_symref ).
|
||||||
ENDMETHOD. "create
|
ENDMETHOD. "create
|
||||||
|
|
||||||
|
METHOD get_head_symref.
|
||||||
|
rv_head_symref = mv_head_symref.
|
||||||
|
ENDMETHOD. " get_head_symref.
|
||||||
|
|
||||||
METHOD find_by_name.
|
METHOD find_by_name.
|
||||||
|
|
||||||
IF iv_branch_name IS INITIAL.
|
IF iv_branch_name IS INITIAL.
|
||||||
|
@ -197,7 +208,7 @@ CLASS lcl_git_branch_list IMPLEMENTATION.
|
||||||
IF mv_head_symref IS NOT INITIAL.
|
IF mv_head_symref IS NOT INITIAL.
|
||||||
rs_branch = find_by_name( mv_head_symref ).
|
rs_branch = find_by_name( mv_head_symref ).
|
||||||
ELSE.
|
ELSE.
|
||||||
rs_branch = find_by_name( head_name ).
|
rs_branch = find_by_name( c_head_name ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
ENDMETHOD. "get_head
|
ENDMETHOD. "get_head
|
||||||
|
@ -246,7 +257,7 @@ CLASS lcl_git_branch_list IMPLEMENTATION.
|
||||||
<ls_branch>-name = lv_name.
|
<ls_branch>-name = lv_name.
|
||||||
<ls_branch>-display_name = get_display_name( lv_name ).
|
<ls_branch>-display_name = get_display_name( lv_name ).
|
||||||
<ls_branch>-type = get_type( lv_name ).
|
<ls_branch>-type = get_type( lv_name ).
|
||||||
IF <ls_branch>-name = head_name OR <ls_branch>-name = ev_head_symref.
|
IF <ls_branch>-name = c_head_name OR <ls_branch>-name = ev_head_symref.
|
||||||
<ls_branch>-is_head = abap_true.
|
<ls_branch>-is_head = abap_true.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
|
@ -295,7 +306,7 @@ CLASS lcl_git_branch_list IMPLEMENTATION.
|
||||||
METHOD get_type.
|
METHOD get_type.
|
||||||
rv_type = c_type-other.
|
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.
|
rv_type = c_type-branch.
|
||||||
RETURN.
|
RETURN.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
@ -334,4 +345,11 @@ CLASS lcl_git_branch_list IMPLEMENTATION.
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
ENDMETHOD. "get_tags_only
|
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
|
ENDCLASS. "lcl_git_branch_list
|
|
@ -332,8 +332,7 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
||||||
METHOD render. "TODO refactor
|
METHOD render. "TODO refactor
|
||||||
|
|
||||||
DATA: lv_class TYPE string,
|
DATA: lv_class TYPE string,
|
||||||
lv_is_drop TYPE abap_bool,
|
lv_is_drop TYPE abap_bool.
|
||||||
lv_last TYPE abap_bool.
|
|
||||||
|
|
||||||
FIELD-SYMBOLS <ls_item> LIKE LINE OF mt_items.
|
FIELD-SYMBOLS <ls_item> LIKE LINE OF mt_items.
|
||||||
|
|
||||||
|
@ -359,13 +358,8 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
||||||
IF iv_as_angle = abap_true.
|
IF iv_as_angle = abap_true.
|
||||||
ro_html->add( '<div class="dropbtn_angle"></div>' ).
|
ro_html->add( '<div class="dropbtn_angle"></div>' ).
|
||||||
ELSE.
|
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
|
ro_html->add_a( iv_txt = iv_as_droplist_with_label
|
||||||
iv_class = lv_class
|
iv_class = 'dropbtn'
|
||||||
iv_act = '' ).
|
iv_act = '' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
@ -386,15 +380,8 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
LOOP AT mt_items ASSIGNING <ls_item>.
|
LOOP AT mt_items ASSIGNING <ls_item>.
|
||||||
lv_last = boolc( sy-tabix = lines( mt_items ) ).
|
|
||||||
|
|
||||||
IF <ls_item>-sub IS INITIAL.
|
IF <ls_item>-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.
|
IF iv_with_icons = abap_true.
|
||||||
ro_html->add( '<tr>' ).
|
ro_html->add( '<tr>' ).
|
||||||
|
@ -405,8 +392,7 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
||||||
ro_html->add_a( iv_txt = <ls_item>-txt
|
ro_html->add_a( iv_txt = <ls_item>-txt
|
||||||
iv_act = <ls_item>-act
|
iv_act = <ls_item>-act
|
||||||
iv_opt = <ls_item>-opt
|
iv_opt = <ls_item>-opt
|
||||||
iv_typ = <ls_item>-typ
|
iv_typ = <ls_item>-typ ).
|
||||||
iv_class = lv_class ).
|
|
||||||
|
|
||||||
IF iv_with_icons = abap_true.
|
IF iv_with_icons = abap_true.
|
||||||
ro_html->add( '</td>' ).
|
ro_html->add( '</td>' ).
|
||||||
|
@ -414,9 +400,7 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
ELSE.
|
ELSE.
|
||||||
ro_html->add( <ls_item>-sub->render(
|
ro_html->add( <ls_item>-sub->render( iv_as_droplist_with_label = <ls_item>-txt ) ).
|
||||||
iv_as_droplist_with_label = <ls_item>-txt
|
|
||||||
iv_no_separator = lv_last ) ).
|
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
|
@ -426,7 +410,8 @@ CLASS lcl_html_toolbar IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
IF lv_is_drop = abap_true. " Dropdown
|
IF lv_is_drop = abap_true. " Dropdown
|
||||||
ro_html->add( '</div></div>' ).
|
ro_html->add( '</div>' ).
|
||||||
|
ro_html->add( '</div>' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
ro_html->add( '</div>' ).
|
ro_html->add( '</div>' ).
|
||||||
|
|
|
@ -162,7 +162,8 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION.
|
||||||
|
|
||||||
lv_text = lcl_git_branch_list=>get_display_name( iv_branch ).
|
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'.
|
lv_class = 'branch branch_head'.
|
||||||
ELSEIF lcl_git_branch_list=>get_type( iv_branch ) = lcl_git_branch_list=>c_type-branch.
|
ELSEIF lcl_git_branch_list=>get_type( iv_branch ) = lcl_git_branch_list=>c_type-branch.
|
||||||
lv_class = 'branch branch_branch'.
|
lv_class = 'branch branch_branch'.
|
||||||
|
|
|
@ -174,7 +174,7 @@ CLASS lcl_popups IMPLEMENTATION.
|
||||||
CLEAR: ev_name, ev_cancel.
|
CLEAR: ev_name, ev_cancel.
|
||||||
|
|
||||||
* TAB FLD LABEL DEF ATTR
|
* 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'
|
CALL FUNCTION 'POPUP_GET_VALUES'
|
||||||
EXPORTING
|
EXPORTING
|
||||||
|
@ -195,7 +195,8 @@ CLASS lcl_popups IMPLEMENTATION.
|
||||||
ELSE.
|
ELSE.
|
||||||
READ TABLE lt_fields INDEX 1 ASSIGNING <ls_field>.
|
READ TABLE lt_fields INDEX 1 ASSIGNING <ls_field>.
|
||||||
ASSERT sy-subrc = 0.
|
ASSERT sy-subrc = 0.
|
||||||
ev_name = lcl_git_branch_list=>complete_heads_branch_name( <ls_field>-value ).
|
ev_name = lcl_git_branch_list=>complete_heads_branch_name(
|
||||||
|
lcl_git_branch_list=>normalize_branch_name( <ls_field>-value ) ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
@ -284,6 +285,7 @@ CLASS lcl_popups IMPLEMENTATION.
|
||||||
|
|
||||||
DATA: lo_branches TYPE REF TO lcl_git_branch_list,
|
DATA: lo_branches TYPE REF TO lcl_git_branch_list,
|
||||||
lt_branches TYPE lcl_git_branch_list=>ty_git_branch_list_tt,
|
lt_branches TYPE lcl_git_branch_list=>ty_git_branch_list_tt,
|
||||||
|
lv_head_suffix TYPE string,
|
||||||
lv_answer TYPE c LENGTH 1,
|
lv_answer TYPE c LENGTH 1,
|
||||||
lv_default TYPE i VALUE 1, "Default cursor position
|
lv_default TYPE i VALUE 1, "Default cursor position
|
||||||
lt_selection TYPE TABLE OF spopli.
|
lt_selection TYPE TABLE OF spopli.
|
||||||
|
@ -293,15 +295,30 @@ CLASS lcl_popups IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
lo_branches = lcl_git_transport=>branches( iv_url ).
|
lo_branches = lcl_git_transport=>branches( iv_url ).
|
||||||
|
|
||||||
lt_branches = lo_branches->get_branches_only( ).
|
lt_branches = lo_branches->get_branches_only( ).
|
||||||
LOOP AT lt_branches ASSIGNING <ls_branch>.
|
lv_head_suffix = | ({ lcl_git_branch_list=>c_head_name })|.
|
||||||
APPEND INITIAL LINE TO lt_selection ASSIGNING <ls_sel>.
|
|
||||||
<ls_sel>-varoption = <ls_branch>-name.
|
|
||||||
|
|
||||||
|
LOOP AT lt_branches ASSIGNING <ls_branch>.
|
||||||
|
|
||||||
|
IF <ls_branch>-name = lcl_git_branch_list=>c_head_name
|
||||||
|
AND <ls_branch>-name <> lo_branches->get_head_symref( ).
|
||||||
|
" HEAD but other HEAD symref exist
|
||||||
|
CONTINUE.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
APPEND INITIAL LINE TO lt_selection ASSIGNING <ls_sel>.
|
||||||
IF iv_default_branch IS NOT INITIAL AND iv_default_branch = <ls_branch>-name.
|
IF iv_default_branch IS NOT INITIAL AND iv_default_branch = <ls_branch>-name.
|
||||||
lv_default = sy-tabix.
|
lv_default = sy-tabix.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
IF <ls_branch>-name = lo_branches->get_head_symref( )
|
||||||
|
AND <ls_branch>-name <> lcl_git_branch_list=>c_head_name.
|
||||||
|
" HEAD symref but not HEAD itself
|
||||||
|
<ls_sel>-varoption = <ls_branch>-display_name && lv_head_suffix.
|
||||||
|
ELSE.
|
||||||
|
<ls_sel>-varoption = <ls_branch>-display_name.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
|
|
||||||
IF iv_show_new_option = abap_true.
|
IF iv_show_new_option = abap_true.
|
||||||
|
@ -339,7 +356,10 @@ CLASS lcl_popups IMPLEMENTATION.
|
||||||
IF iv_show_new_option = abap_true AND <ls_sel>-varoption = c_new_branch_label.
|
IF iv_show_new_option = abap_true AND <ls_sel>-varoption = c_new_branch_label.
|
||||||
rs_branch-name = c_new_branch_label.
|
rs_branch-name = c_new_branch_label.
|
||||||
ELSE.
|
ELSE.
|
||||||
rs_branch = lo_branches->find_by_name( <ls_sel>-varoption ).
|
REPLACE FIRST OCCURRENCE OF lv_head_suffix IN <ls_sel>-varoption WITH ''.
|
||||||
|
READ TABLE lt_branches WITH KEY display_name = <ls_sel>-varoption ASSIGNING <ls_branch>.
|
||||||
|
ASSERT sy-subrc = 0.
|
||||||
|
rs_branch = lo_branches->find_by_name( <ls_branch>-name ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user