rubbish_code 1.1.1 → 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: 8977c1f85f3d3c5a73e2d51cdf33e7104520fb2e4a9a531e394e2e6645af8ff3
4
- data.tar.gz: 84ba679d683b6a3f43b5bc3f488c793c199bba66480fb4844b9d31f8e8b2cbf4
3
+ metadata.gz: e60f77dbf44fe895c2c670c35df9bf1d3b6a6ba7bf0a16a1a901f12dba350b74
4
+ data.tar.gz: 1ae50fc68a7df5d95b13e2585f8bee12db493c91364b20028537925ba883fcab
5
5
  SHA512:
6
- metadata.gz: 4c8ef12b68cab719993c6284ddfa5ba6dd7d8d2a4c9f8273cc31f53a248e807dbaf43739b84173eb06987057fd75e4c1ccf13cc5d30382f6c607f85c6928d096
7
- data.tar.gz: dba57235d419c0645ca35bf425fefdfade42c187b22944b96288810f3110349ae60b78fb51040b92a4c90070f079c4dbed89afb0a173c05aad22f6bff530a546
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.1"
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.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Epps
@@ -48,7 +48,6 @@ files:
48
48
  - lib/source/models/student.rb
49
49
  - lib/source/models/student_base.rb
50
50
  - lib/source/models/student_short.rb
51
- - lib/source/models/student_test.rb
52
51
  - lib/source/repositories/adapters/db_source_adapter.rb
53
52
  - lib/source/repositories/adapters/file_source_adapter.rb
54
53
  - lib/source/repositories/containers/data_list.rb
@@ -61,10 +60,6 @@ files:
61
60
  - lib/source/repositories/data_sources/transformers/data_transformer_yaml.rb
62
61
  - lib/source/repositories/student_repository.rb
63
62
  - lib/source/util/logger_holder.rb
64
- - lib/source/views/main_window.rb
65
- - lib/source/views/student_input_form.rb
66
- - lib/source/views/tab_students.rb
67
- - rubbish_code-1.1.0.gem
68
63
  - rubbish_code.gemspec
69
64
  - sig/ribbish_code.rbs
70
65
  homepage: https://github.com/Jakepps/Ruby_Moment
@@ -1,71 +0,0 @@
1
- require 'test/unit'
2
- require_relative 'student'
3
-
4
- class TestStudent < Test::Unit::TestCase
5
- def setup
6
- @student = Student.new('Иванов', 'Иван', 'Иванович')
7
- end
8
-
9
- def test_full_name
10
- assert_equal('Иванов Иван Иванович', @student.to_s.split(', ')[0])
11
- end
12
-
13
- def test_contacts
14
- @student = Student.new('Иванов', 'Иван', 'Иванович')
15
- @student.set_contacts(phone: '+79991234567', email: 'ivanov@example.com')
16
- assert_equal('+79991234567', @student.phone)
17
- assert_equal('ivanov@example.com', @student.email)
18
- end
19
-
20
- def test_valid_name
21
- assert(Student.valid_name?('Иванов'))
22
- assert(!Student.valid_name?('Сидоров-Петров'))
23
- assert(!Student.valid_name?('X'))
24
- assert(Student.valid_name?('Abcdefghijklmnopqrstuvwxyz'))
25
- assert(!Student.valid_name?(''))
26
- assert(!Student.valid_name?('Иванов 123'))
27
- assert(!Student.valid_name?('Иванов.'))
28
- assert(!Student.valid_name?('-Иванов'))
29
- end
30
-
31
- def test_from_hash
32
- hash = {
33
- first_name: 'Иван',
34
- last_name: 'Иванов',
35
- father_name: 'Иванович',
36
- phone: '+79991234567',
37
- telegram: 'ivanov',
38
- email: 'ivanov@example.com',
39
- git: 'ivanov'
40
- }
41
- student = Student.from_hash(hash)
42
- assert_equal(hash[:first_name], student.first_name)
43
- assert_equal(hash[:last_name], student.last_name)
44
- assert_equal(hash[:father_name], student.father_name)
45
- assert_equal(hash[:phone], student.phone)
46
- assert_equal(hash[:telegram], student.telegram)
47
- assert_equal(hash[:email], student.email)
48
- assert_equal(hash[:git], student.git)
49
- end
50
-
51
- def test_from_json_str
52
- hash = {
53
- first_name: 'Иван',
54
- last_name: 'Иванов',
55
- father_name: 'Иванович',
56
- phone: '+79991234567',
57
- telegram: 'ivanov',
58
- email: 'ivanov@example.com',
59
- git: 'ivanov'
60
- }
61
- json_str = hash.to_json
62
- student = Student.from_json_str(json_str)
63
- assert_equal(hash[:first_name], student.first_name)
64
- assert_equal(hash[:last_name], student.last_name)
65
- assert_equal(hash[:father_name], student.father_name)
66
- assert_equal(hash[:phone], student.phone)
67
- assert_equal(hash[:telegram], student.telegram)
68
- assert_equal(hash[:email], student.email)
69
- assert_equal(hash[:git], student.git)
70
- end
71
- end
@@ -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