rubbish_code 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcca354a4ed34bf8fadbca3bea1446428d093658c6e04a9a9e55392519595c2a
4
- data.tar.gz: 8e2050f98952c6a81f20b5d06f57daf0aebebe52a37c52274043d3d568d4ad77
3
+ metadata.gz: e60f77dbf44fe895c2c670c35df9bf1d3b6a6ba7bf0a16a1a901f12dba350b74
4
+ data.tar.gz: 1ae50fc68a7df5d95b13e2585f8bee12db493c91364b20028537925ba883fcab
5
5
  SHA512:
6
- metadata.gz: 60c01d2085635ddecf247c739ff1c66705bc790b807fb1e91d564eb67c801daad10fc14427b62d7571d4398afa581e8c300dc9b8ddd7dc141626704aa0335961
7
- data.tar.gz: 62330e0e25cd7f637aa6c0a56d5828077ff0536e2e55ca7186f50559322d13e981b5614634e5d77ad51e2472694be8b96854da28ba298c5af464d8ab7df0c529
6
+ metadata.gz: fd3064e442d8c7f9f7dfdc66ef237b101902913e532bdd2130eee1e552b9f93ff538caf98c80097a478f266ecb2e02c5fbe1bd34d747c54502b1813fb74f7d94
7
+ data.tar.gz: 28cb17390dee1db13b35896ca0880c444451b7362a5f03e1913b1fc3731f4f1dc5b6a24a6b959a42f6a601182bea7e2a3e8f006dfef891b39a1b7d8cc7e04aa4
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubbishCode
4
- VERSION = "1.1.2"
4
+ VERSION = "1.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubbish_code
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Epps
@@ -60,11 +60,6 @@ files:
60
60
  - lib/source/repositories/data_sources/transformers/data_transformer_yaml.rb
61
61
  - lib/source/repositories/student_repository.rb
62
62
  - lib/source/util/logger_holder.rb
63
- - lib/source/views/main_window.rb
64
- - lib/source/views/student_input_form.rb
65
- - lib/source/views/tab_students.rb
66
- - rubbish_code-1.1.0.gem
67
- - rubbish_code-1.1.1.gem
68
63
  - rubbish_code.gemspec
69
64
  - sig/ribbish_code.rbs
70
65
  homepage: https://github.com/Jakepps/Ruby_Moment
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'glimmer-dsl-libui'
4
- require_relative 'tab_students'
5
-
6
- class MainWindow
7
- include Glimmer
8
-
9
- def initialize
10
- @view_tab_students = TabStudents.new
11
- end
12
-
13
- def create
14
- window('Универ', 900, 200) {
15
- tab {
16
- tab_item('Студенты') {
17
- @view_tab_students.create
18
- }
19
-
20
- tab_item('Вкладка 2') { }
21
- tab_item('Вкладка 3') { }
22
- }
23
- }
24
- end
25
- end
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'glimmer-dsl-libui'
4
- require 'source/controllers/student_input_form/student_input_form_controller_create'
5
- require 'source/models/student_base'
6
- require 'source/controllers/tab_students_controller'
7
- require 'win32api'
8
-
9
- class StudentInputForm
10
- include Glimmer
11
-
12
- def initialize(controller, existing_student = nil)
13
- @existing_student = existing_student.to_hash unless existing_student.nil?
14
- @controller = controller
15
- @entries = {}
16
- end
17
-
18
- def on_create
19
- @controller.on_view_created
20
- end
21
-
22
- def create
23
- @root_container = window('Универ', 300, 150) {
24
- resizable false
25
-
26
- vertical_box {
27
- @student_form = form {
28
- stretchy false
29
-
30
- fields = [[:last_name, 'Фамилия', false], [:first_name, 'Имя', false], [:father_name, 'Отчество', false], [:git, 'Гит', true], [:telegram, 'Телеграм', true], [:email, 'Почта', true], [:phone, 'Телефон', true]]
31
-
32
- fields.each do |field|
33
- @entries[field[0]] = entry {
34
- label field[1]
35
- }
36
- end
37
- }
38
-
39
- button('Сохранить') {
40
- stretchy false
41
-
42
- on_clicked {
43
- values = @entries.transform_values { |v| v.text.force_encoding("utf-8").strip }
44
- values.transform_values! { |v| v.empty? ? nil : v}
45
-
46
- @controller.process_fields(values)
47
- @controller.refresh()
48
- }
49
- }
50
- }
51
- }
52
- on_create
53
- @root_container
54
- end
55
-
56
- def set_value(field, value)
57
- return unless @entries.include?(field)
58
-
59
- @entries[field].text = value
60
- end
61
-
62
- def make_readonly(*fields)
63
- fields.each do |field|
64
- @entries[field].read_only = true
65
- end
66
- end
67
-
68
- def close
69
- @root_container.destroy
70
- end
71
- end
@@ -1,171 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'glimmer-dsl-libui'
4
- require 'source/controllers/tab_students_controller'
5
- require 'source/views/student_input_form'
6
-
7
- class TabStudents
8
- include Glimmer
9
-
10
- STUDENTS_PER_PAGE = 20
11
-
12
- def initialize
13
- @controller = TabStudentsController.new(self)
14
- @current_page = 1
15
- @total_count = 0
16
- end
17
-
18
- def on_create
19
- @controller.on_view_created
20
- @controller.refresh_data(@current_page, STUDENTS_PER_PAGE)
21
- end
22
-
23
- # Метод наблюдателя datalist
24
- def on_datalist_changed(new_table)
25
- arr = new_table.to_2d_array
26
- arr.map do |row|
27
- row[3] = [row[3][:value], contact_color(row[3][:type])] unless row[3].nil?
28
- end
29
- @table.model_array = arr
30
- end
31
-
32
- def update_student_count(new_cnt)
33
- @total_count = new_cnt
34
- @page_label.text = "#{@current_page} / #{(@total_count / STUDENTS_PER_PAGE.to_f).ceil}"
35
- end
36
-
37
- def contact_color(type)
38
- case type
39
- when 'telegram'
40
- '#00ADB5'
41
- when 'email'
42
- '#F08A5D'
43
- when 'phone'
44
- '#B83B5E'
45
- else
46
- '#000000'
47
- end
48
- end
49
-
50
- def create
51
- root_container = horizontal_box {
52
- # Секция 1
53
- vertical_box {
54
- stretchy false
55
-
56
- form {
57
- stretchy false
58
-
59
- @filter_last_name_initials = entry {
60
- label 'Фамилия И. О.'
61
- }
62
-
63
- @filters = {}
64
- fields = [[:git, 'Гит'], [:email, 'Почта'], [:phone, 'Телефон'], [:telegram, 'Телеграм']]
65
-
66
- fields.each do |field|
67
- @filters[field[0]] = {}
68
-
69
- @filters[field[0]][:combobox] = combobox {
70
- label "#{field[1]} имеется?"
71
- items ['Не важно', 'Есть', 'Нет']
72
- selected 0
73
-
74
- on_selected do
75
- if @filters[field[0]][:combobox].selected == 1
76
- @filters[field[0]][:entry].read_only = false
77
- else
78
- @filters[field[0]][:entry].text = ''
79
- @filters[field[0]][:entry].read_only = true
80
- end
81
- end
82
- }
83
-
84
- @filters[field[0]][:entry] = entry {
85
- label field[1]
86
- read_only true
87
- }
88
- end
89
- }
90
- }
91
-
92
- # Секция 2
93
- vertical_box {
94
- @table = refined_table(
95
- table_editable: false,
96
- filter: lambda do |row_hash, query|
97
- utf8_query = query.force_encoding("utf-8")
98
- row_hash['Фамилия И. О'].include?(utf8_query)
99
- end,
100
- table_columns: {
101
- '#' => :text,
102
- 'Фамилия И. О' => :text,
103
- 'Гит' => :text,
104
- 'Контакт' => :text_color
105
- },
106
- per_page: STUDENTS_PER_PAGE
107
- )
108
-
109
- @pages = horizontal_box {
110
- stretchy false
111
-
112
- button("<") {
113
- stretchy true
114
-
115
- on_clicked do
116
- @current_page = [@current_page - 1, 1].max
117
- @controller.refresh_data(@current_page, STUDENTS_PER_PAGE)
118
- end
119
-
120
- }
121
- @page_label = label("...") { stretchy false }
122
- button(">") {
123
- stretchy true
124
-
125
- on_clicked do
126
- @current_page = [@current_page + 1, (@total_count / STUDENTS_PER_PAGE.to_f).ceil].min
127
- @controller.refresh_data(@current_page, STUDENTS_PER_PAGE)
128
- end
129
- }
130
- }
131
- }
132
-
133
- # Секция 3
134
- vertical_box {
135
- stretchy false
136
-
137
- button('Добавить') {
138
- stretchy false
139
-
140
- on_clicked {
141
- @controller.show_modal_add
142
- }
143
- }
144
- button('Изменить') {
145
- stretchy false
146
-
147
- on_clicked {
148
- @controller.show_modal_edit(@current_page, STUDENTS_PER_PAGE, @table.selection) unless @table.selection.nil?
149
- }
150
- }
151
- button('Удалить') {
152
- stretchy false
153
-
154
- on_clicked {
155
- @controller.delete_selected(@current_page, STUDENTS_PER_PAGE, @table.selection) unless @table.selection.nil?
156
- @controller.refresh_data(@current_page, STUDENTS_PER_PAGE)
157
- }
158
- }
159
- button('Обновить') {
160
- stretchy false
161
-
162
- on_clicked {
163
- @controller.refresh_data(@current_page, STUDENTS_PER_PAGE)
164
- }
165
- }
166
- }
167
- }
168
- on_create
169
- root_container
170
- end
171
- end
Binary file
Binary file